iliaa Mon Jul 21 17:49:52 2003 EDT Added files: (Branch: PHP_4_3) /php-src/ext/session/tests bug24592.phpt
Modified files: /php-src/ext/session session.c /php-src NEWS Log: MFH: Fixed bug #24592 (Possible crash in session extnsion, with NULL values). Index: php-src/ext/session/session.c diff -u php-src/ext/session/session.c:1.336.2.18 php-src/ext/session/session.c:1.336.2.19 --- php-src/ext/session/session.c:1.336.2.18 Mon Jun 9 23:57:16 2003 +++ php-src/ext/session/session.c Mon Jul 21 17:49:52 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.336.2.18 2003/06/10 03:57:16 sas Exp $ */ +/* $Id: session.c,v 1.336.2.19 2003/07/21 21:49:52 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -635,9 +635,12 @@ switch (n) { case HASH_KEY_IS_STRING: - zend_hash_find(&EG(symbol_table), str, str_len, (void **) &val); - if (val) { - ZEND_SET_SYMBOL_WITH_LENGTH(ht, str, str_len, *val, (*val)->refcount + 1 , 1); + if (zend_hash_find(&EG(symbol_table), str, str_len, (void **) &val) == SUCCESS && val) { + if (!PZVAL_IS_REF(*val)) { + (*val)->is_ref = 1; + (*val)->refcount += 1; + zend_hash_update(ht, str, str_len, val, sizeof(zval *), NULL); + } ret = 1; } break; Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.291 php-src/NEWS:1.1247.2.292 --- php-src/NEWS:1.1247.2.291 Mon Jul 21 10:03:42 2003 +++ php-src/NEWS Mon Jul 21 17:49:52 2003 @@ -11,6 +11,8 @@ - Fixed possible crash in imagerotate() when an invalid color index is used for background color. (Pierre-Alain Joye) - Fixed bug #24640 (var_export and var_dump can't output large float). (Marcus) +- Fixed bug #24592 (Possible crash in session extnsion, with NULL values). + (Ilia) - Fixed bug #24573 (debug_backtrace() crashes if $this set to null). (Jani) - Fixed bug #24560 (parse_url() incorrectly handling certain file:// based schemas). (Ilia) Index: php-src/ext/session/tests/bug24592.phpt +++ php-src/ext/session/tests/bug24592.phpt --TEST-- Bug #24592 (crash when multiple NULL values are being stored) --INI-- register_globals=0 html_errors=0 --FILE-- <?php @session_start(); $foo = $_SESSION['foo']; $bar = $_SESSION['bar']; var_dump($foo, $bar, $_SESSION); $_SESSION['foo'] = $foo; $_SESSION['bar'] = $bar; var_dump($_SESSION); ?> --EXPECTF-- Notice: Undefined index: foo in %s on line %d Notice: Undefined index: bar in %s on line %d NULL NULL array(0) { } array(2) { ["foo"]=> NULL ["bar"]=> NULL } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php