]> granicus.if.org Git - php/commitdiff
[DOC]- Fixed bug #45956 (parse_ini_file() does not return false with syntax errors...
authorJani Taskinen <jani@php.net>
Sun, 31 Aug 2008 00:19:21 +0000 (00:19 +0000)
committerJani Taskinen <jani@php.net>
Sun, 31 Aug 2008 00:19:21 +0000 (00:19 +0000)
[DOC] note: change will be in since 5.2.7

ext/standard/basic_functions.c
ext/standard/tests/file/parse_ini_file.phpt
ext/standard/tests/file/parse_ini_file_error.phpt
ext/standard/tests/general_functions/parse_ini_basic.phpt
ext/standard/tests/general_functions/parse_ini_file-win32.phpt
ext/standard/tests/general_functions/parse_ini_file.phpt

index b2aa51df7163f14a11079518bbb1e3ee7a88704c..0d63a80d557d504cf65db836787be4a648b6e2d5 100644 (file)
@@ -6491,7 +6491,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 053dd2934775a6e69b19d8ec480812f597198cdd..1847329a0912533d7b704872b24a127e8d121ca2 100644 (file)
@@ -9,7 +9,7 @@ Test parse_ini_file() function
 
 $file_path = dirname(__FILE__);
 
-$parse_string = <<<EOD
+$parse_string = (binary) <<<EOD
 ; Comment starts with semi-colon(;)
 ; Section starts with [<section name>]
 
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 e0280141380219c25512012c5a1446557e2d4efe..00acbbc9c44138e7585802b20fb49fa093fef2f4 100644 (file)
@@ -45,7 +45,7 @@ array(25) {
     [u"dqstring"]=>
     unicode(46) "asdadfsdjkslkj ¡@£$$ { } !^~|¥¥{[()/)&/% ¤ # #"
     [u"php_constant"]=>
-    unicode(5) "16383"
+    unicode(5) "32767"
     [u"user_constant"]=>
     unicode(21) "this_is_test_constant"
   }
@@ -76,7 +76,7 @@ array(25) {
     [u"dqstring"]=>
     unicode(34) "asdadfsdjkslkj ¡@£$$€¥¥{[()/)&/%#¤"
     [u"php_constant"]=>
-    unicode(5) "16383"
+    unicode(5) "32767"
   }
   [u"comments"]=>
   array(1) {
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 dcb29ce06f16418bb9ac98d428aae74aa5ac6a3e..c89de96618e1de67f3933b25a680e5bdea515eae 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) {
   [u"test"]=>
   unicode(0) ""
@@ -129,17 +127,11 @@ array(1) {
 
 Warning: %s error%sin %sparse_ini_file.dat on line 2
  in %sparse_ini_file.php on line 20
-array(1) {
-  [u"test"]=>
-  unicode(0) ""
-}
+bool(false)
 
 Warning: %serror%sin %sparse_ini_file.dat on line 2
  in %sparse_ini_file.php on line 26
-array(1) {
-  [u"test"]=>
-  unicode(4) "test"
-}
+bool(false)
 array(1) {
   [u"test"]=>
   unicode(8) "new