summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-05-26 02:18:17 (GMT)
committerFelipe Pena <felipe@php.net>2010-05-26 02:18:17 (GMT)
commitde531056f7d002a5b0fea12c1e320e2abe2823c2 (patch)
treefa7145670f3dcedd18e970f27da8390f95e04705
parent79d2aaf0f1775f89a775b2d2d793dff8bb0e7755 (diff)
downloadphp-de531056f7d002a5b0fea12c1e320e2abe2823c2.tar.gz
- Fixed bug #51899 (Parse error in parse_ini_file() function when empy value followed by no newline)
-rw-r--r--Zend/zend_ini_scanner.c4
-rw-r--r--Zend/zend_ini_scanner.l2
-rw-r--r--Zend/zend_ini_scanner_defs.h2
-rw-r--r--ext/standard/tests/strings/bug51899.phpt37
4 files changed, 41 insertions, 4 deletions
diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c
index 2499797..1677d3e 100644
--- a/Zend/zend_ini_scanner.c
+++ b/Zend/zend_ini_scanner.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Feb 7 13:25:37 2010 */
+/* Generated by re2c 0.13.5 on Tue May 25 22:53:58 2010 */
#line 1 "Zend/zend_ini_scanner.l"
/*
+----------------------------------------------------------------------+
@@ -317,7 +317,7 @@ restart:
if (YYCURSOR >= YYLIMIT) {
if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) {
BEGIN(INITIAL);
- return 0;
+ return END_OF_LINE;
}
return 0;
}
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 741dcc0..1c19a09 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -315,7 +315,7 @@ restart:
if (YYCURSOR >= YYLIMIT) {
if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) {
BEGIN(INITIAL);
- return 0;
+ return END_OF_LINE;
}
return 0;
}
diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h
index 1956b62..4107238 100644
--- a/Zend/zend_ini_scanner_defs.h
+++ b/Zend/zend_ini_scanner_defs.h
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Feb 7 13:25:37 2010 */
+/* Generated by re2c 0.13.5 on Tue May 25 22:53:58 2010 */
#line 3 "Zend/zend_ini_scanner_defs.h"
enum YYCONDTYPE {
diff --git a/ext/standard/tests/strings/bug51899.phpt b/ext/standard/tests/strings/bug51899.phpt
new file mode 100644
index 0000000..fb430cf
--- /dev/null
+++ b/ext/standard/tests/strings/bug51899.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #51899 (Parse error in parse_ini_file() function when empy value followed by no newline)
+--FILE--
+<?php
+
+var_dump(parse_ini_string('a='));
+var_dump(parse_ini_string('a= '));
+var_dump(parse_ini_string('a='.PHP_EOL));
+var_dump(parse_ini_string('a=b '));
+var_dump(parse_ini_string(''));
+var_dump(parse_ini_string(NULL));
+var_dump(parse_ini_string("\0"));
+
+?>
+--EXPECT--
+array(1) {
+ ["a"]=>
+ string(0) ""
+}
+array(1) {
+ ["a"]=>
+ string(0) ""
+}
+array(1) {
+ ["a"]=>
+ string(0) ""
+}
+array(1) {
+ ["a"]=>
+ string(2) "b "
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}