]> 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:21:19 +0000 (00:21 +0000)
committerJani Taskinen <jani@php.net>
Sun, 31 Aug 2008 00:21:19 +0000 (00:21 +0000)
[DOC] note: change will be in since 5.2.7

NEWS
ext/standard/basic_functions.c
ext/standard/tests/file/parse_ini_file_error.phpt
ext/standard/tests/general_functions/parse_ini_file.phpt
tests/security/open_basedir_parse_ini_file.phpt

diff --git a/NEWS b/NEWS
index 5798e3e2a5c8dae8ee0bd498e06821cfd00feb09..be0c340b800966d19718362ed61aa44ad2ed4a07 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@ PHP                                                                        NEWS
 - 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)
index 668d7cbc4b224802cb505df6a77a8a953eca3ff9..50729fb9097e1578f96eaa088f4de1ff47d53976 100644 (file)
@@ -6305,7 +6305,11 @@ PHP_FUNCTION(parse_ini_file)
        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;
+       }
 }
 /* }}} */
 
index 65a6ac1d8a95954b4c42c8f8724dcb85c732f7e7..599ae191a7eb3003e0f78fd4d23c3fd4c383665e 100644 (file)
@@ -47,6 +47,5 @@ NULL
 -- 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 399a224db95f043aad6cbc07d31d5c7672e7d72b..156ccb0a9df03b1d6d10f8989cf59dc6696d20f5 100644 (file)
@@ -102,12 +102,10 @@ Warning: Wrong parameter count for parse_ini_file() in %s on line %d
 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 @@ array(1) {
 
 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
index dadddac981c46624ae3dd3f17c0f5e63e836ed34..e2f9046352333c5e2419f248975b2e1cae4fda46 100644 (file)
@@ -34,41 +34,34 @@ bool(true)
 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] ***