jani Sun Aug 31 00:21:20 2008 UTC Modified files: (Branch: PHP_5_2) /php-src NEWS /php-src/ext/standard basic_functions.c /php-src/ext/standard/tests/file parse_ini_file_error.phpt /php-src/ext/standard/tests/general_functions parse_ini_file.phpt /php-src/tests/security open_basedir_parse_ini_file.phpt Log: [DOC]- Fixed bug #45956 (parse_ini_file() does not return false with syntax errors in parsed file) [DOC] note: change will be in since 5.2.7 http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1207&r2=1.2027.2.547.2.1208&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1207 php-src/NEWS:1.2027.2.547.2.1208 --- php-src/NEWS:1.2027.2.547.2.1207 Wed Aug 27 07:48:36 2008 +++ php-src/NEWS Sun Aug 31 00:21:19 2008 @@ -19,6 +19,8 @@ - Fixed a crash on invalid method in ReflectionParameter constructor. (Christian Seiler) +- Fixed bug #45956 (parse_ini_file() does not return false with syntax errors + in parsed file). (Jani) - Fixed bug #45862 (get_class_vars is inconsistent with 'protected' and 'private' variables). (ilewis at uk dot ibm dot com, Felipe) - Fixed bug #45805 (Crash on throwing exception from error handler). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.74&r2=1.725.2.31.2.75&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.74 php-src/ext/standard/basic_functions.c:1.725.2.31.2.75 --- php-src/ext/standard/basic_functions.c:1.725.2.31.2.74 Mon Aug 18 10:50:10 2008 +++ php-src/ext/standard/basic_functions.c Sun Aug 31 00:21:19 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.725.2.31.2.74 2008/08/18 10:50:10 jani Exp $ */ +/* $Id: basic_functions.c,v 1.725.2.31.2.75 2008/08/31 00:21:19 jani Exp $ */ #include "php.h" #include "php_streams.h" @@ -6305,7 +6305,11 @@ Z_TYPE(fh) = ZEND_HANDLE_FILENAME; array_init(return_value); - zend_parse_ini_file(&fh, 0, ini_parser_cb, return_value); + if (zend_parse_ini_file(&fh, 0, ini_parser_cb, return_value) == FAILURE) { + zend_hash_destroy(Z_ARRVAL_P(return_value)); + efree(Z_ARRVAL_P(return_value)); + RETURN_FALSE; + } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/parse_ini_file_error.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/file/parse_ini_file_error.phpt diff -u php-src/ext/standard/tests/file/parse_ini_file_error.phpt:1.1.2.1 php-src/ext/standard/tests/file/parse_ini_file_error.phpt:1.1.2.2 --- php-src/ext/standard/tests/file/parse_ini_file_error.phpt:1.1.2.1 Wed Mar 19 17:23:28 2008 +++ php-src/ext/standard/tests/file/parse_ini_file_error.phpt Sun Aug 31 00:21:19 2008 @@ -47,6 +47,5 @@ -- Testing parse_ini_file() function with a non-existent file -- Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d -array(0) { -} +bool(false) Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/parse_ini_file.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/general_functions/parse_ini_file.phpt diff -u php-src/ext/standard/tests/general_functions/parse_ini_file.phpt:1.1.2.2 php-src/ext/standard/tests/general_functions/parse_ini_file.phpt:1.1.2.3 --- php-src/ext/standard/tests/general_functions/parse_ini_file.phpt:1.1.2.2 Thu Nov 16 13:01:23 2006 +++ php-src/ext/standard/tests/general_functions/parse_ini_file.phpt Sun Aug 31 00:21:19 2008 @@ -102,12 +102,10 @@ NULL Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s on line %d -array(0) { -} +bool(false) Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s on line %d -array(0) { -} +bool(false) array(1) { ["test"]=> string(0) "" @@ -115,17 +113,11 @@ Warning: Error parsing %sparse_ini_file.dat on line 2 in %s on line %d -array(1) { - ["test"]=> - string(0) "" -} +bool(false) Warning: Error parsing %sparse_ini_file.dat on line 2 in %s on line %d -array(1) { - ["test"]=> - string(4) "test" -} +bool(false) array(1) { ["test"]=> string(8) "new http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_parse_ini_file.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/tests/security/open_basedir_parse_ini_file.phpt diff -u php-src/tests/security/open_basedir_parse_ini_file.phpt:1.1.2.1 php-src/tests/security/open_basedir_parse_ini_file.phpt:1.1.2.2 --- php-src/tests/security/open_basedir_parse_ini_file.phpt:1.1.2.1 Fri May 9 08:35:58 2008 +++ php-src/tests/security/open_basedir_parse_ini_file.phpt Sun Aug 31 00:21:19 2008 @@ -34,41 +34,34 @@ Warning: parse_ini_file(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d Warning: parse_ini_file(../bad): failed to open stream: Operation not permitted in %s on line %d -array(0) { -} +bool(false) Warning: parse_ini_file(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d Warning: parse_ini_file(../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d -array(0) { -} +bool(false) Warning: parse_ini_file(..): failed to open stream: Operation not permitted in %s on line %d -array(0) { -} +bool(false) Warning: parse_ini_file(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d Warning: parse_ini_file(../): failed to open stream: Operation not permitted in %s on line %d -array(0) { -} +bool(false) Warning: parse_ini_file(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d Warning: parse_ini_file(../bad/.): failed to open stream: Operation not permitted in %s on line %d -array(0) { -} +bool(false) Warning: parse_ini_file(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d Warning: parse_ini_file(../bad/./bad.txt): failed to open stream: Operation not permitted in %s on line %d -array(0) { -} +bool(false) Warning: parse_ini_file(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d Warning: parse_ini_file(./../.): failed to open stream: Operation not permitted in %s on line %d -array(0) { -} +bool(false) *** Finished testing open_basedir configuration [parse_ini_file] ***