Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.0a3

Request #16462 add json_decode-function that behaves like in PHP5.2
Submitted: 2009-07-22 17:40 UTC
From: peterk Assigned: hm2k
Status: Closed Package: PHP_Compat (version 1.5.0)
PHP Version: 5.1.6 OS: CentOS5
Roadmaps: 1.6.0a3    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 15 + 18 = ?

 
 [2009-07-22 17:40 UTC] peterk (Peter Körner)
Description: ------------ JSON in PHP 5.1 is loaded via PECL-Module. The json_decode- function of the PECL-Module does not accept scalar- values like "false" but only arrays and objects, while the native version embedded with PHP 5.2 does. Test script: --------------- <?php // does not work under PHP 5.1 with PECL-Module but works with PHP 5.2 // see http://php.net/manual/en/function.json-decode.php#69383 $v = true; $jv = json_encode($v); $xv = json_decode($jv); var_dump($xv); // this works with every instance of the json_decode-function $v = true; $jv = json_encode($v); $xv = json_decode('['.$jv.']'); $xv = count($xv) ? $xv[0] : null; var_dump($xv); ?> Expected result: ---------------- bool(true) bool(true) as it is on php 5.2 Actual result: -------------- NULL bool(true) as is in php 5.1 with PECL-Module

Comments

 [2010-08-01 19:57 UTC] hm2k (James Wade)
-Status: Open +Status: Closed -Assigned To: +Assigned To: hm2k
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. At revision: 301762