Zend Framework

Zend_Json::decode() returns exception when mbstring.func_overload activated

Details

Description

Hi,

I'm translating an application to UTF-8 and I have a problem with the Zend_Json::decode().

I've json strings stored in database and they are decoded correctly on my old non UTF8 apache server.

If I run the same code with the same json string on my utf-8 apache config, I have an exception
<b> Fatal error </ b>: Uncaught exception 'Zend_Json_Exception' with message 'Missing "," in object encoding:

I tried to identify the issue and it appears when I activate the option mbstring.func_overload in my httpd.conf.

The json string has been validated by online validators and is correctly parsed by javascript.

Regards

HJ

Activity

Hide
Matthew Weier O'Phinney added a comment -

Is ext/json enabled on your server? i.e., are you using PHP's native JSON support, or ZF's implementation to decode the JSON string? (Zend_Json::decode() proxies to ext/json if it's enabled). This information will allow me to better track down the issue.

If you are not using ext/json, can you attempt to enable it to see if using it solves the issues?

Show
Matthew Weier O'Phinney added a comment - Is ext/json enabled on your server? i.e., are you using PHP's native JSON support, or ZF's implementation to decode the JSON string? (Zend_Json::decode() proxies to ext/json if it's enabled). This information will allow me to better track down the issue. If you are not using ext/json, can you attempt to enable it to see if using it solves the issues?
Hide
Henry Jean added a comment -

In phpinfo, i see json enabled (version 1.2.1)

Show
Henry Jean added a comment - In phpinfo, i see json enabled (version 1.2.1)
Hide
Henry Jean added a comment -

I forgot :

I'm using the decoder like this :

Zend_Json::$useBuiltinEncoderDecoder = true; //same exception with false
$o = Zend_Json::decode($json_str);

my php version : 5.2.6

Show
Henry Jean added a comment - I forgot : I'm using the decoder like this : Zend_Json::$useBuiltinEncoderDecoder = true; //same exception with false $o = Zend_Json::decode($json_str); my php version : 5.2.6
Hide
Henry Jean added a comment -

I changed the value of mbstring.func_overload in php config and the problem occurs only with mbstring.func_overload=7.
So only if ereg functions are overloaded

Regards

HJ

Show
Henry Jean added a comment - I changed the value of mbstring.func_overload in php config and the problem occurs only with mbstring.func_overload=7. So only if ereg functions are overloaded Regards HJ

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: