cvs: php-src(PHP_4_3) / NEWS /ext/standard basic_functions.c

From: Date: Mon, 10 Nov 2003 04:12:51 +0000
Subject: cvs: php-src(PHP_4_3) / NEWS /ext/standard basic_functions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-24478@lists.php.net to get a copy of this message
iliaa Sun Nov 9 23:12:51 2003 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /php-src/ext/standard basic_functions.c Log: MFH: Fixed bug #26176 (Fixed handling of numeric keys in INI files). Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.462 php-src/NEWS:1.1247.2.463 --- php-src/NEWS:1.1247.2.462 Fri Nov 7 23:45:18 2003 +++ php-src/NEWS Sun Nov 9 23:12:49 2003 @@ -3,6 +3,7 @@ ?? ??? 2003, Version 4.3.5 - Fixed header handler in NSAPI SAPI module (header->replace was ignored, send_default_content_type now sends value from php.ini). (Uwe Schindler) +- Fixed bug #26176 (Fixed handling of numeric keys in INI files). (Ilia) - Fixed bug #26148 (Print the notice before modifying variable on type mismatch). (morten-bugs dot php dot net at afdelingp dot dk, Ilia) - Fixed bug #26128 (mbstring prints out wrong information on phpinfo()). Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.543.2.25 php-src/ext/standard/basic_functions.c:1.543.2.26 --- php-src/ext/standard/basic_functions.c:1.543.2.25 Sun Oct 19 21:59:48 2003 +++ php-src/ext/standard/basic_functions.c Sun Nov 9 23:12:50 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.543.2.25 2003/10/20 01:59:48 iliaa Exp $ */ +/* $Id: basic_functions.c,v 1.543.2.26 2003/11/10 04:12:50 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -2789,7 +2789,12 @@ *element = *arg2; zval_copy_ctor(element); INIT_PZVAL(element); - zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL); + if (is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) != IS_LONG) { + zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL); + } else { + ulong key = (ulong) zend_atoi(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); + zend_hash_index_update(Z_ARRVAL_P(arr), key, &element, sizeof(zval *), NULL); + } break; case ZEND_INI_PARSER_SECTION: @@ -2822,20 +2827,27 @@ *element = *arg2; zval_copy_ctor(element); INIT_PZVAL(element); - zend_hash_update(Z_ARRVAL_P(active_arr), Z_STRVAL_P(arg1), + if (is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) != IS_LONG) { + zend_hash_update(Z_ARRVAL_P(active_arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL); + } else { + ulong key = (ulong) zend_atoi(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); + zend_hash_index_update(Z_ARRVAL_P(active_arr), key, &element, sizeof(zval *), NULL); + } } break; case ZEND_INI_PARSER_SECTION: MAKE_STD_ZVAL(BG(active_ini_file_section)); array_init(BG(active_ini_file_section)); - zend_hash_update( Z_ARRVAL_P(arr), - Z_STRVAL_P(arg1), - Z_STRLEN_P(arg1)+1, - &BG(active_ini_file_section), - sizeof(zval *), NULL); + if (is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) != IS_LONG) { + zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, + &BG(active_ini_file_section), sizeof(zval *), NULL); + } else { + ulong key = (ulong) zend_atoi(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); + zend_hash_index_update(Z_ARRVAL_P(arr), key, &BG(active_ini_file_section), sizeof(zval *), NULL); + } break; } }

« previous php.cvs (#24478) next »