]> granicus.if.org Git - php/commitdiff
Allow underscore at start of labels as underscore has no meaning here
authorArnaud Le Blanc <lbarnaud@php.net>
Sun, 17 Aug 2008 21:51:36 +0000 (21:51 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Sun, 17 Aug 2008 21:51:36 +0000 (21:51 +0000)
(fixes #44842)

Zend/zend_ini_scanner.l
ext/standard/tests/general_functions/parse_ini_file.phpt

index f7cb2903d25c0bad6b30359cdc23c7aa129d8be6..b10007686233c961cb5729fc99a8b3bc60f3c4b6 100644 (file)
@@ -312,7 +312,7 @@ NEWLINE     ("\r"|"\n"|"\r\n")
 TABS_AND_SPACES [ \t]
 WHITESPACE [ \t]+
 CONSTANT [a-zA-Z][a-zA-Z0-9_]*
-LABEL [a-zA-Z0-9][a-zA-Z0-9._-]*
+LABEL [a-zA-Z0-9_][a-zA-Z0-9._-]*
 TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?@{}]
 OPERATORS [&|~()!]
 DOLLAR_CURLY "${"
index f08717f934f5ce2e147e709d67dbc26984170693..e24c45444cdc9e914f1cf19b96c48fd54d3725ad 100644 (file)
@@ -94,6 +94,15 @@ $ini = "[section1]\nname = value";
 file_put_contents($filename, $ini);
 var_dump(parse_ini_file($filename, true));
 
+/* #44842, labels starting with underscore */
+$ini = <<<'INI'
+foo=bar1
+_foo=bar2
+foo_=bar3
+INI;
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
 @unlink($filename);
 echo "Done\n";
 ?>
@@ -182,4 +191,12 @@ array(1) {
     unicode(5) "value"
   }
 }
+array(3) {
+  [u"foo"]=>
+  unicode(4) "bar1"
+  [u"_foo"]=>
+  unicode(4) "bar2"
+  [u"foo_"]=>
+  unicode(4) "bar3"
+}
 Done