Scott MacVicar wrote:
Not sure if I agree with this change, it has never meant to work and
doesn't work with any of the ini parsers in other languages.

The point is it works in e.g. PHP 5.2.x..

--Jani


If anything I would make it an E_NOTICE.

Scott

Arnaud Le Blanc wrote:
lbarnaud                Sun Nov  2 23:36:10 2008 UTC

  Modified files:              (Branch: PHP_5_3)
/php-src NEWS /ZendEngine2 zend_ini_scanner.l /php-src/ext/standard/tests/general_functions parse_ini_file.phpt Log:
  Fixed bug #44575 (parse_ini_file comment # line problems)
  [DOC] parse_ini_file(): comments starting with # are deprecated in PHP 5.3
        (comments starting with ; should be used instead)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.358&r2=1.2027.2.547.2.965.2.359&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.358 
php-src/NEWS:1.2027.2.547.2.965.2.359
--- php-src/NEWS:1.2027.2.547.2.965.2.358       Sun Nov  2 23:06:27 2008
+++ php-src/NEWS        Sun Nov  2 23:36:10 2008
@@ -59,6 +59,7 @@
 - Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). (Ilia)
 - Fixed bug #45382 (timeout bug in stream_socket_enable_crypto).
   (vnegrier at optilian dot com, Ilia)
+- Fixed bug #44575 (parse_ini_file comment # line problems). (Arnaud)
 - Fixed bug #44135 (PDO MySQL does not support CLIENT_FOUND_ROWS). (Johannes,
   chx1975 at gmail dot com)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_ini_scanner.l?r1=1.41.2.2.2.2.2.11&r2=1.41.2.2.2.2.2.12&diff_format=u
Index: ZendEngine2/zend_ini_scanner.l
diff -u ZendEngine2/zend_ini_scanner.l:1.41.2.2.2.2.2.11 
ZendEngine2/zend_ini_scanner.l:1.41.2.2.2.2.2.12
--- ZendEngine2/zend_ini_scanner.l:1.41.2.2.2.2.2.11    Thu Sep 11 00:33:38 2008
+++ ZendEngine2/zend_ini_scanner.l      Sun Nov  2 23:36:10 2008
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
-/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.2.2.11 2008/09/11 00:33:38 stas Exp $ */
+/* $Id: zend_ini_scanner.l,v 1.41.2.2.2.2.2.12 2008/11/02 23:36:10 lbarnaud 
Exp $ */
#include <errno.h>
 #include "zend.h"
@@ -480,6 +480,13 @@
        return END_OF_LINE;
 }
+<INITIAL>{TABS_AND_SPACES}*[#][^\r\n]*{NEWLINE} { /* #Comment */
+       zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on 
line %d", ini_filename, SCNG(lineno));
+       BEGIN(INITIAL);
+       SCNG(lineno)++;
+       return END_OF_LINE;
+}
+
 <ST_VALUE,ST_RAW>[^] { /* End of option value (if EOF is reached before EOL */
        BEGIN(INITIAL);
        return END_OF_LINE;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/parse_ini_file.phpt?r1=1.1.2.2.2.5&r2=1.1.2.2.2.6&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.2.5 
php-src/ext/standard/tests/general_functions/parse_ini_file.phpt:1.1.2.2.2.6
--- 
php-src/ext/standard/tests/general_functions/parse_ini_file.phpt:1.1.2.2.2.5    
    Sun Aug 31 00:19:50 2008
+++ php-src/ext/standard/tests/general_functions/parse_ini_file.phpt    Sun Nov 
 2 23:36:10 2008
@@ -105,6 +105,18 @@
 file_put_contents($filename, $ini);
 var_dump(parse_ini_file($filename, true));
+/* #44575, comments starting with '#' */
+$ini = <<<'INI'
+foo=bar1
+; comment
+_foo=bar2
+# comment
+foo_=bar3
+INI;
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+
 @unlink($filename);
 echo "Done\n";
 ?>
@@ -193,4 +205,14 @@
   ["foo_"]=>
   string(4) "bar3"
 }
+
+Deprecated: Comments starting with '#' are deprecated in %s
+array(3) {
+  ["foo"]=>
+  string(4) "bar1"
+  ["_foo"]=>
+  string(4) "bar2"
+  ["foo_"]=>
+  string(4) "bar3"
+}
 Done





--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to