note 117804 deleted from function.json-decode by cmb

From: Date: Wed, 12 Aug 2015 13:20:52 +0000
Subject: note 117804 deleted from function.json-decode by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203321@lists.php.net to get a copy of this message
Note Submitter: Lukasz Luczak ---- I have noticed change in behaviour between 5.5.25 and 5.5.27: On 5.5.25 we have: [lluczak]$ php -v PHP 5.5.25 (cli) (built: May 16 2015 07:23:58) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies with Xdebug v2.2.7, Copyright (c) 2002-2015, by Derick Rethans [lluczak@llpc fcc]$ php -a Interactive shell php > $str = '[NULL]'; php > echo ($str); [NULL] php > print_r(json_decode($str,true)); Array ( [0] => ) php > var_dump(json_decode($str,true)); array(1) { [0] => NULL } But on 5.5.27 we have [root@coin tmp]# php -v PHP 5.5.27 (cli) (built: Jul 10 2015 23:40:40) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies [root@coin tmp]# php -a Interactive shell php > $str = '[NULL]'; php > echo ($str); [NULL] php > print_r(json_decode($str,true)); php > var_dump(json_decode($str,true)); NULL php > You can notice that for '[NULL]', php 5.5.25 returns array with one element which is null but php 5.5.27 returns null. If you provide '[null]' then it works well on both versions. In changelog there is mentioned that at 5.6.0 there is "Invalid non-lowercased variants of the true, false and null literals are no longer accepted as valid input, and will generate warnings. " but in fact it works also for 5.5.27

« previous php.notes (#203321) next »