Page MenuHomePhabricator

PHP Fatal error: Call to undefined function json_encode() in includes/json/FormatJson.php on line 130
Closed, ResolvedPublic

Description

PHP Fatal error: Call to undefined function json_encode() in /home/jidanni/mediawiki/includes/json/FormatJson.php on line 130

The whole wiki breaks.


Version: 1.22.0
Severity: critical
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=49122

Details

Reference
bz49114

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:46 AM
bzimport set Reference to bz49114.
bzimport added a subscriber: Unknown Object (MLST).

Use of undefined constant JSON_UNESCAPED_SLASHES - assumed 'JSON_UNESCAPED_SLASHES'
Use of undefined constant JSON_UNESCAPED_UNICODE - assumed 'JSON_UNESCAPED_UNICODE'
Use of undefined constant JSON_HEX_TAG - assumed 'JSON_HEX_TAG' in /home/jidanni/me
Use of undefined constant JSON_HEX_AMP - assumed 'JSON_HEX_AMP' in /home/jidanni/me

seen in git as of
$ date -u
Tue Jun 4 12:41:24 UTC 2013

$ dpkg -l \*php*|grep ^ii
ii libapache2-mod-php5 5.5.0~rc2+dfsg- i386 server-side, HTML-embedded scripting language (A
ii php-doc 20100521-2 all Documentation for PHP5
ii php-elisp 1.5.0-1.1 all Emacs support for php files
ii php-gettext 1.0.11-1 all read gettext MO files directly, without requirin
ii php5 5.5.0~rc2+dfsg- all server-side, HTML-embedded scripting language (m
ii php5-cgi 5.5.0~rc2+dfsg- i386 server-side, HTML-embedded scripting language (C
ii php5-cli 5.5.0~rc2+dfsg- i386 command-line interpreter for the php5 scripting
ii php5-common 5.5.0~rc2+dfsg- i386 Common files for packages built from the php5 so
ii php5-mcrypt 5.5.0~rc2+dfsg- i386 MCrypt module for php5
ii php5-mysql 5.5.0~rc2+dfsg- i386 MySQL module for php5
ii phpmyadmin 4:4.0.1-2 all MySQL web administration tool

json_encode has been around for a while, and we use it in the code paths for older PHP, just with some different options set where they are available.

It would sound like your current version is missing the json support for some reason or another.

As you're running PHP 5.5 rc2, I'd contact whoever is your upstream package provider and tell them of the issue. I can't really believe this is MediaWiki at fault, and as 5.5 rc2 came out a couple of weeks ago...

Oops...
php5 (5.5.0~rc1+dfsg-1) experimental; urgency=low

  • Starting from this version, the JSON module is no longer compiled in due to licensing problems, and you need to install the JSON extension as external php5-json package that is using json-c library.
  • Ondřej Surý <ondrej@debian.org> Fri, 17 May 2013 14:43:04 +0200

And the Debian bug is http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692613 :

% rgrep 'The Software shall be used for Good, not Evil.' .
./README.REDIST.BINS:The Software shall be used for Good, not Evil.
./ext/json/utf8_to_utf16.c:The Software shall be used for Good, not Evil.
./ext/json/utf8_decode.c:The Software shall be used for Good, not Evil.
./ext/json/JSON_parser.c:The Software shall be used for Good, not Evil.

:-D

  • This bug has been marked as a duplicate of bug 49122 ***