Skip to content

Commit b8af7ee

Browse files
committed
Nextcloud 13 is not compatible with newer than php 7.2
Just to avoid users from trying this with a to new (untested) php version * Moved the check logic to 1 place * All directly callable scripts just require this on top * exit hard (-1) so we know scripts won't continue * Return status 500 so no sync clients will try fancy stuff Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
1 parent 115e7e2 commit b8af7ee

9 files changed

Lines changed: 31 additions & 21 deletions

File tree

console.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,14 @@
2929
*
3030
*/
3131

32+
require_once __DIR__ . '/lib/versioncheck.php';
33+
3234
use OC\Console\Application;
3335
use Symfony\Component\Console\Input\ArgvInput;
3436
use Symfony\Component\Console\Output\ConsoleOutput;
3537

3638
define('OC_CONSOLE', 1);
3739

38-
// Show warning if a PHP version below 5.6.0 is used, this has to happen here
39-
// because base.php will already use 5.6 syntax.
40-
if (version_compare(PHP_VERSION, '5.6.0') === -1) {
41-
echo 'This version of Nextcloud requires at least PHP 5.6.0'.PHP_EOL;
42-
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'.PHP_EOL;
43-
return;
44-
}
45-
4640
function exceptionHandler($exception) {
4741
echo "An unhandled exception has been thrown:" . PHP_EOL;
4842
echo $exception;

cron.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@
3434
*
3535
*/
3636

37-
// Show warning if a PHP version below 5.6.0 is used
38-
if (version_compare(PHP_VERSION, '5.6.0') === -1) {
39-
echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>';
40-
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
41-
return;
42-
}
37+
require_once __DIR__ . '/lib/versioncheck.php';
4338

4439
try {
4540

index.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@
2828
*
2929
*/
3030

31-
// Show warning if a PHP version below 5.6.0 is used, this has to happen here
32-
// because base.php will already use 5.6 syntax.
33-
if (version_compare(PHP_VERSION, '5.6.0') === -1) {
34-
echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>';
35-
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
36-
return;
37-
}
31+
require_once __DIR__ . '/lib/versioncheck.php';
3832

3933
try {
4034

lib/versioncheck.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
// Show warning if a PHP version below 5.6.0 is used, this has to happen here
4+
// because base.php will already use 5.6 syntax.
5+
if (version_compare(PHP_VERSION, '5.6.0') === -1) {
6+
http_response_code(500);
7+
echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>';
8+
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
9+
exit(-1);
10+
}
11+
12+
// Show warning if > PHP 7.2 is used as Nextcloud is not compatible with > PHP 7.2 for now
13+
if (version_compare(PHP_VERSION, '7.3.0') !== -1) {
14+
http_response_code(500);
15+
echo 'This version of Nextcloud is not compatible with > PHP 7.2.<br/>';
16+
echo 'You are currently running ' . PHP_VERSION . '.';
17+
exit(-1);
18+
}

ocs/providers.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*
2424
*/
2525

26+
require_once __DIR__ . '/../lib/versioncheck.php';
2627
require_once __DIR__ . '/../lib/base.php';
2728

2829
header('Content-type: application/xml');

ocs/v1.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*
3030
*/
3131

32+
require_once __DIR__ . '/../lib/versioncheck.php';
3233
require_once __DIR__ . '/../lib/base.php';
3334

3435
if (\OCP\Util::needUpgrade()

public.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
* along with this program. If not, see <http://www.gnu.org/licenses/>
2828
*
2929
*/
30+
31+
require_once __DIR__ . '/lib/versioncheck.php';
32+
3033
try {
3134

3235
require_once __DIR__ . '/lib/base.php';

remote.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
*
2929
*/
3030

31+
require_once __DIR__ . '/lib/versioncheck.php';
32+
3133
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
3234
use Sabre\DAV\Exception\ServiceUnavailable;
3335
use Sabre\DAV\Server;

status.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*
3030
*/
3131

32+
require_once __DIR__ . '/lib/versioncheck.php';
33+
3234
try {
3335

3436
require_once __DIR__ . '/lib/base.php';

0 commit comments

Comments
 (0)