]> granicus.if.org Git - php/commitdiff
MFH:- Fixed bug #45956 (parse_ini_file() does not return false with syntax errors...
authorJani Taskinen <jani@php.net>
Sun, 31 Aug 2008 00:19:50 +0000 (00:19 +0000)
committerJani Taskinen <jani@php.net>
Sun, 31 Aug 2008 00:19:50 +0000 (00:19 +0000)
ext/standard/basic_functions.c
ext/standard/tests/file/parse_ini_file_error.phpt
ext/standard/tests/general_functions/parse_ini_file-win32.phpt
ext/standard/tests/general_functions/parse_ini_file.phpt

index 0fc77d4cdf3be02483c3cdef9e32ae8547f9e207..253cdccc2197bada9cde6ee5625976fc1cfccf7f 100644 (file)
@@ -6359,7 +6359,11 @@ PHP_FUNCTION(parse_ini_file)
        fh.type = ZEND_HANDLE_FILENAME;
 
        array_init(return_value);
-       zend_parse_ini_file(&fh, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC);
+       if (zend_parse_ini_file(&fh, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
+               zend_hash_destroy(Z_ARRVAL_P(return_value));
+               efree(Z_ARRVAL_P(return_value));
+               RETURN_FALSE;
+       }
 }
 /* }}} */
 
index db63f2cdb62e1ffc502c29111a0869e0500402ee..9482df8a4dbb2ba422281e28c672bdb22d67586f 100644 (file)
@@ -42,12 +42,10 @@ bool(false)
 -- Testing parse_ini_file() function with more than expected no. of arguments --
 
 Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d
-array(0) {
-}
+bool(false)
 
 -- 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
index cd7d9f84422b7b0fba00d55d170493a80aedb317..7a1d63010d90cf344f07ad0c088d2cb7738bc205 100644 (file)
@@ -116,12 +116,10 @@ Warning: parse_ini_file() expects at most 3 parameters, 4 given in %s on line 7
 bool(false)
 
 Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s.php on line 8
-array(0) {
-}
+bool(false)
 
 Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s.php on line 9
-array(0) {
-}
+bool(false)
 array(1) {
   ["test"]=>
   string(0) ""
@@ -129,17 +127,11 @@ array(1) {
 
 Warning: parse error in %s on line %d
  in %s on line 20
-array(1) {
-  ["test"]=>
-  string(0) ""
-}
+bool(false)
 
 Warning: parse error in %s on line %d
  in %s on line 26
-array(1) {
-  ["test"]=>
-  string(4) "test"
-}
+bool(false)
 array(1) {
   ["test"]=>
   string(8) "new
index 9aa30f9e69bd54eb41892fab09de5faecc5df229..65a29e0022ddad4ca8dc43f269dedb95cd57e9ca 100644 (file)
@@ -116,12 +116,10 @@ Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_f
 bool(false)
 
 Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8
-array(0) {
-}
+bool(false)
 
 Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9
-array(0) {
-}
+bool(false)
 array(1) {
   ["test"]=>
   string(0) ""
@@ -129,17 +127,11 @@ array(1) {
 
 Warning: syntax error, unexpected '=' in %sparse_ini_file.dat on line 2
  in %sparse_ini_file.php on line 20
-array(1) {
-  ["test"]=>
-  string(0) ""
-}
+bool(false)
 
 Warning: syntax error, unexpected '=' in %sparse_ini_file.dat on line 2
  in %sparse_ini_file.php on line 26
-array(1) {
-  ["test"]=>
-  string(4) "test"
-}
+bool(false)
 array(1) {
   ["test"]=>
   string(8) "new