php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59808 Compilation error: too many arguments to function 'php_json_decode'
Submitted: 2011-06-09 10:19 UTC Modified: 2011-11-10 14:13 UTC
Votes:19
Avg. Score:4.9 ± 0.2
Reproduced:19 of 19 (100.0%)
Same Version:4 (21.1%)
Same OS:5 (26.3%)
From: eborned at gmail dot com Assigned: tony2001 (profile)
Status: Closed Package: solr (PECL)
PHP Version: 5.2.17 OS: Debian
Private report: No CVE-ID: None
 [2011-06-09 10:19 UTC] eborned at gmail dot com
Description:
------------
While compiling the new 1.0.1 version of this plugin, I get the following compile errors:

 cc -I. -I/usr/src/solr-1.0.1 -DPHP_ATOM_INC -I/usr/src/solr-1.0.1/include -I/usr/src/solr-1.0.1/main -I/usr/src/solr-1.0.1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -DHAVE_CONFIG_H -g -O2 -c /usr/src/solr-1.0.1/solr_functions_helpers.c  -fPIC -DPIC -o .libs/solr_functions_helpers.o
/usr/src/solr-1.0.1/solr_functions_helpers.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'json_globals'
/usr/src/solr-1.0.1/solr_functions_helpers.c: In function 'solr_json_to_php_native':
/usr/src/solr-1.0.1/solr_functions_helpers.c:1123: error: too many arguments to function 'php_json_decode'
make: *** [solr_functions_helpers.lo] Error 1

Looks like an incompatibility with PHP 5.2.17?



Patches

peclsolr.patch (last revision 2011-10-13 14:18 UTC by alex at discardmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-12 08:49 UTC] mitchelsblake at gmail dot com
I am experiencing this same problem. I am running 5.2.16.
 [2011-08-15 09:57 UTC] jeff at deepbass dot net
Same issue.
OSX/PHP 5.3.5
But the make stop right after
solr_functions_helpers.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'json_globals'
make: *** [solr_functions_helpers.lo] Error 1
 [2011-08-31 18:47 UTC] ken dot williams at meteorgames dot com
Confirmed same issue with php 5.2.11 / Cent5.4
 [2011-09-05 07:51 UTC] james at siteace dot co dot uk
I can confirm i have the same issue installing or upgrading on 
centOS/Plesk and PHP 5.2.10

I have installed the beta version without issue
 [2011-09-06 13:15 UTC] badllama77 at gmail dot com
Same issue
ubuntu 9.04/php 5.2.6
ubuntu 10.04/php 5.2.10

/home/emyers/src/solr-1.0.1/solr_functions_helpers.c:23: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?json_globals?
/home/emyers/src/solr-1.0.1/solr_functions_helpers.c: In function ?solr_json_to_php_native?:
/home/emyers/src/solr-1.0.1/solr_functions_helpers.c:1123: error: too many arguments to function ?php_json_decode?
 [2011-10-11 15:18 UTC] php at discardmail dot com
Same error on CentOS 5.3 and PHP 5.2.13:

./configure --enable-solr=yes --enable-solr-debug=no --with-curl=/usr/include/curl --with-libxml-dir=/usr/include/libxml2
make

solr-1.0.1/solr_functions_helpers.c:23: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âjson_globalsâ
solr-1.0.1/solr_functions_helpers.c: In function âsolr_json_to_php_nativeâ:
solr-1.0.1/solr_functions_helpers.c:1123: error: too many arguments to function âphp_json_decodeâ
make: *** [solr_functions_helpers.lo] Error 1
 [2011-10-13 14:23 UTC] alex at discardmail dot com
I have searched through the PHP source tree of 5.2 and 5.3 where it can be seen that the function php_json_decode (in php/ext/json/php_json.h) requires 5 arguments in PHP 5.3 and 4 in PHP 5.2:
 PHP 5.2: php_json_decode(zval *return_value, char *buf, int buf_len, zend_bool assoc TSRMLS_DC);
 PHP 5.3: php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, long depth TSRMLS_DC)
Solr-PECL wants to call php_json_decode with 5 parameters (in solr-1.0.1/solr_functions_helpers.c):
 php_json_decode(&json_decode_ret_val, (char *) json_string, json_string_length, 1, recursion_depth TSRMLS_CC);
So it can not be compiled with PHP 5.2 in that way. Additionally the command "ZEND_EXTERN_MODULE_GLOBALS(json)" does not work with PHP 5.2.

I've added a patch which uses the 4-argument-function and does not use "ZEND_EXTERN_MODULE_GLOBALS(json)" at PHP 5.2. I have not tested if php_json_decode is working after this patch, but at least PECL-solr can be compiled with PHP 5.2 and the other functions are working.

Because of this bug it can not be installed via PECL/PEAR, but manually:
wget http://pecl.php.net/get/solr-1.0.1.tgz
tar xfz solr-1.0.1.tgz
cd solr-1.0.1
wget -Opeclsolr.patch 'https://bugs.php.net/patch-display.php?bug_id=59808&patch=peclsolr.patch&revision=latest&download=1'
patch solr_functions_helpers.c peclsolr.patch
phpize
./configure
make
make install

And then add the extension to your php.ini and restart Apache:
extension = solr.so
 [2011-11-10 14:13 UTC] tony2001@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: tony2001
 [2011-11-10 14:13 UTC] tony2001@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC