Last modified: 2013-04-23 19:07:45 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T49356, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47356 - Use of undefined constant JSON_UNESCAPED_SLASHES
Use of undefined constant JSON_UNESCAPED_SLASHES
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.22.0
All All
: Unprioritized blocker (vote)
: ---
Assigned To: Nobody - You can work on this!
: code-update-regression
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-18 09:08 UTC by Fomafix
Modified: 2013-04-23 19:07 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Fomafix 2013-04-18 09:08:15 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?
Comment 1 Sam Reed (reedy) 2013-04-18 11:54:45 UTC
(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/
Comment 2 Brad Jorsch 2013-04-18 16:51:11 UTC
(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?
Comment 3 Fomafix 2013-04-18 17:28:25 UTC
Now I installed the packet php-json (ftp://ftp.cygwinports.org/pub/cygwinports/release-2/PHP/php/php-json/) and now it works again.
Comment 4 Krinkle 2013-04-19 12:21:42 UTC
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.
Comment 5 Brad Jorsch 2013-04-19 13:20:56 UTC
(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?
Comment 6 Fomafix 2013-04-23 10:51:06 UTC
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.
Comment 7 Kevin Israel (PleaseStand) 2013-04-23 19:07:45 UTC
(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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links