felipe Thu Oct 2 03:41:24 2008 UTC Added files: (Branch: PHP_5_2) /php-src/ext/json/tests bug46215.phpt
Modified files: /php-src NEWS /php-src/ext/json json.c Log: - MFH: Fixed bug #46215 (json_encode mutates its parameter and has some class-specific state) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1236&r2=1.2027.2.547.2.1237&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1236 php-src/NEWS:1.2027.2.547.2.1237 --- php-src/NEWS:1.2027.2.547.2.1236 Wed Oct 1 12:37:15 2008 +++ php-src/NEWS Thu Oct 2 03:41:24 2008 @@ -18,10 +18,12 @@ (Scott) - Fixed a crash on invalid method in ReflectionParameter constructor. (Christian Seiler) +- Fixed bug #46215 (json_encode mutates its parameter and has some + class-specific state). (Felipe) - Fixed bug #46191 (BC break: DOMDocument saveXML() doesn't accept null). (Rob) - Fixed bug #46157 (PDOStatement::fetchObject prototype error). (Felipe) -- Fixed bug #46147 (after stream seek, appending stream filter reads incorrect data). - (Greg) +- Fixed bug #46147 (after stream seek, appending stream filter reads + incorrect data). (Greg) - Fixed bug #46088 (RegexIterator::accept - segfault). (Felipe) - Fixed bug #46059 (Compile failure under IRIX 6.5.30 building posix.c). (Arnaud) http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.23&r2=1.9.2.24&diff_format=u Index: php-src/ext/json/json.c diff -u php-src/ext/json/json.c:1.9.2.23 php-src/ext/json/json.c:1.9.2.24 --- php-src/ext/json/json.c:1.9.2.23 Fri Aug 22 08:17:02 2008 +++ php-src/ext/json/json.c Thu Oct 2 03:41:24 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: json.c,v 1.9.2.23 2008/08/22 08:17:02 sebastian Exp $ */ +/* $Id: json.c,v 1.9.2.24 2008/10/02 03:41:24 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -181,6 +181,9 @@ if (i == HASH_KEY_IS_STRING) { if (key[0] == '\0' && Z_TYPE_PP(val) == IS_OBJECT) { /* Skip protected and private members. */ + if (tmp_ht) { + tmp_ht->nApplyCount--; + } continue; } http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug46215.phpt?view=markup&rev=1.1 Index: php-src/ext/json/tests/bug46215.phpt +++ php-src/ext/json/tests/bug46215.phpt --TEST-- Bug #46215 (json_encode mutates its parameter and has some class-specific state) --FILE-- <?php class foo { protected $a = array(); } $a = new foo; $x = json_encode($a); print_r($a); ?> --EXPECT-- foo Object ( [a:protected] => Array ( ) ) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php