jani                                     Mon, 30 Nov 2009 22:38:32 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=291525

Log:
- Fixed bug #50340 (php.ini parser does not allow spaces in ini keys)

Bug: http://bugs.php.net/50340 (Open) php.ini parser does not allow spaces in 
ini keys
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l
    U   php/php-src/trunk/Zend/zend_ini_scanner.l

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-11-30 21:55:56 UTC (rev 291524)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-11-30 22:38:32 UTC (rev 291525)
@@ -23,6 +23,7 @@
 - Fixed memory leak in extension loading when an error occurs on Windows.
   (Pierre)

+- Fixed bug #50340 (php.ini parser does not allow spaces in ini keys). (Jani)
 - Fixed bug #50285 (xmlrpc does not preserve keys in encoded indexed arrays).
   (Felipe)
 - Fixed bug #50282 (xmlrpc_encode_request() changes object into array in

Modified: php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l        2009-11-30 
21:55:56 UTC (rev 291524)
+++ php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l        2009-11-30 
22:38:32 UTC (rev 291525)
@@ -105,6 +105,17 @@
 ZEND_API zend_ini_scanner_globals ini_scanner_globals;
 #endif

+/* Eat leading whitespace */
+#define EAT_LEADING_WHITESPACE()                     \
+       while (yytext[0]) {                              \
+               if (yytext[0] == ' ' || yytext[0] == '\t') { \
+                       SCNG(yy_text)++;                         \
+                       yyleng--;                                \
+               } else {                                     \
+                       break;                                   \
+               }                                            \
+       }
+
 /* Eat trailing whitespace + extra char */
 #define EAT_TRAILING_WHITESPACE_EX(ch)              \
        while (yyleng > 0 && (                          \
@@ -326,7 +337,7 @@
 TABS_AND_SPACES [ \t]
 WHITESPACE [ \t]+
 CONSTANT [a-zA-Z][a-zA-Z0-9_]*
-LABEL [^=\n\r\t ;|&$~(){}!"\[]+
+LABEL [^=\n\r\t;|&$~(){}!"\[]+
 TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?...@{}]
 OPERATORS [&|~()!]
 DOLLAR_CURLY "${"
@@ -367,6 +378,9 @@
 }

 <INITIAL>{LABEL}"["{TABS_AND_SPACES}* { /* Start of option with offset */
+       /* Eat leading whitespace */
+       EAT_LEADING_WHITESPACE();
+
        /* Eat trailing whitespace and [ */
        EAT_TRAILING_WHITESPACE_EX('[');

@@ -387,6 +401,12 @@
 }

 <ST_VARNAME>{LABEL} { /* Variable name */
+       /* Eat leading whitespace */
+       EAT_LEADING_WHITESPACE();
+
+       /* Eat trailing whitespace */
+       EAT_TRAILING_WHITESPACE();
+
        RETURN_TOKEN(TC_VARNAME, yytext, yyleng);
 }

@@ -404,6 +424,12 @@
 }

 <INITIAL>{LABEL} { /* Get option name */
+       /* Eat leading whitespace */
+       EAT_LEADING_WHITESPACE();
+
+       /* Eat trailing whitespace */
+       EAT_TRAILING_WHITESPACE();
+
        RETURN_TOKEN(TC_LABEL, yytext, yyleng);
 }


Modified: php/php-src/trunk/Zend/zend_ini_scanner.l
===================================================================
--- php/php-src/trunk/Zend/zend_ini_scanner.l   2009-11-30 21:55:56 UTC (rev 
291524)
+++ php/php-src/trunk/Zend/zend_ini_scanner.l   2009-11-30 22:38:32 UTC (rev 
291525)
@@ -105,6 +105,17 @@
 ZEND_API zend_ini_scanner_globals ini_scanner_globals;
 #endif

+/* Eat leading whitespace */
+#define EAT_LEADING_WHITESPACE()                     \
+       while (yytext[0]) {                              \
+               if (yytext[0] == ' ' || yytext[0] == '\t') { \
+                       SCNG(yy_text)++;                         \
+                       yyleng--;                                \
+               } else {                                     \
+                       break;                                   \
+               }                                            \
+       }
+
 /* Eat trailing whitespace + extra char */
 #define EAT_TRAILING_WHITESPACE_EX(ch)              \
        while (yyleng > 0 && (                          \
@@ -326,7 +337,7 @@
 TABS_AND_SPACES [ \t]
 WHITESPACE [ \t]+
 CONSTANT [a-zA-Z][a-zA-Z0-9_]*
-LABEL [^=\n\r\t ;|&$~(){}!"\[]+
+LABEL [^=\n\r\t;|&$~(){}!"\[]+
 TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?...@{}]
 OPERATORS [&|~()!]
 DOLLAR_CURLY "${"
@@ -367,6 +378,9 @@
 }

 <INITIAL>{LABEL}"["{TABS_AND_SPACES}* { /* Start of option with offset */
+       /* Eat leading whitespace */
+       EAT_LEADING_WHITESPACE();
+
        /* Eat trailing whitespace and [ */
        EAT_TRAILING_WHITESPACE_EX('[');

@@ -387,6 +401,12 @@
 }

 <ST_VARNAME>{LABEL} { /* Variable name */
+       /* Eat leading whitespace */
+       EAT_LEADING_WHITESPACE();
+
+       /* Eat trailing whitespace */
+       EAT_TRAILING_WHITESPACE();
+
        RETURN_TOKEN(TC_VARNAME, yytext, yyleng);
 }

@@ -404,6 +424,12 @@
 }

 <INITIAL>{LABEL} { /* Get option name */
+       /* Eat leading whitespace */
+       EAT_LEADING_WHITESPACE();
+
+       /* Eat trailing whitespace */
+       EAT_TRAILING_WHITESPACE();
+
        RETURN_TOKEN(TC_LABEL, yytext, yyleng);
 }


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

Reply via email to