Last modified: 2013-04-23 19:07:45 UTC
After git pull I get the following error message: Notice: Use of undefined constant JSON_UNESCAPED_SLASHES - assumed 'JSON_UNESCAPED_SLASHES' in /srv/www/htdocs/mediawiki/includes/json/FormatJson.php on line 126 Notice: Use of undefined constant JSON_UNESCAPED_UNICODE - assumed 'JSON_UNESCAPED_UNICODE' in /srv/www/htdocs/mediawiki/includes/json/FormatJson.php on line 128 Notice: Use of undefined constant JSON_HEX_TAG - assumed 'JSON_HEX_TAG' in /srv/www/htdocs/mediawiki/includes/json/FormatJson.php on line 129 Notice: Use of undefined constant JSON_HEX_AMP - assumed 'JSON_HEX_AMP' in /srv/www/htdocs/mediawiki/includes/json/FormatJson.php on line 129 Fatal error: Call to undefined function json_encode() in /srv/www/htdocs/mediawiki/includes/json/FormatJson.php on line 130 http://php.net/manual/en/json.constants.php says JSON_UNESCAPED_SLASHES is available since PHP 5.4.0. INSTALL requires PHP 5.3.2 or higher. (https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=INSTALL;h=891be7342527f74f7420e64de92de01516b166a3;hb=HEAD) Is PHP 5.4.0 or higher required? I use PHP 5.4.11 but I get the error message above. Where is the error?
(In reply to comment #0) > Is PHP 5.4.0 or higher required? No it isn't. It should be 5.3.2, though it does look code unconditionally uses code from PHP 5.4: /** * Don't escape /. * Available since PHP 5.4.0. * @link http://php.net/manual/en/json.constants.php */ define ('JSON_UNESCAPED_SLASHES', 64); Caused by https://gerrit.wikimedia.org/r/#/c/50140/
(In reply to comment #0) > I use PHP 5.4.11 but I get the error message above. Where is the error? If you're using 5.4.11, then the 5.3 versus 5.4 issue isn't what's affecting you. Do you have the json extension disabled, perhaps?
Now I installed the packet php-json (ftp://ftp.cygwinports.org/pub/cygwinports/release-2/PHP/php/php-json/) and now it works again.
Since people can compile php with and without certain extensions, perhaps we should extend the conditional beyond the PHP version and also check that that json extension is in fact installed? A simple `function_exists( 'json_encode' )` should suffice. Or perhaps `defined( 'JSON_PRETTY_PRINT' )` if we want to worry about the version of the extension as well.
(In reply to comment #4) > Since people can compile php with and without certain extensions, perhaps we > should extend the conditional beyond the PHP version and also check that that > json extension is in fact installed? And do what, exactly, if not?
It would be nice to have a checker which checks all required packages/extensions/functions. This checker should run on installation and on the fatal error exception error page.
(In reply to comment #6) > It would be nice to have a checker which checks all required > packages/extensions/functions. This checker should run on installation and on > the fatal error exception error page. Filed as bug 47564.