PHP 4.0 Bug #6804 Updated: parse_ini_file is not handling quoted strings properly
| From: | hholzgra@php.net | Date: | Thu, 09 Nov 2000 10:01:26 +0000 |
| Subject: | PHP 4.0 Bug #6804 Updated: parse_ini_file is not handling quoted strings properly | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37512@lists.php.net to get a copy of this message | ||
ID: 6804
Updated by: hholzgra
Reported By: alex@zend.com
Status: Closed
Bug Type: PHP options/info functions
Assigned To:
Comments:
the new ini parser in zend_ini_parser.l gets it right ...
Previous Comments:
---------------------------------------------------------------------------
[2000-09-18 21:02:59] alex@zend.com
In the example below the gpc_order entry has the value "GPC" that should
be imported in the configuration hash as a 3 bytes long string. But it
is imported as 5 bytes with two zero bytes after the "GPC" characters. The patch to
configuration-scanner.l is below the example.
<?
$i = parse_ini_file("/usr/local/lib/php.ini");
print(addslashes($i["gpc_order"]));
print("n");
?>
--- configuration-scanner.l Mon Jun 26 21:15:49 2000
+++ /home/alex/develop/php-4.0.2.ok/main/configuration-scanner.l Tue Sep 19 09:01:46 2000
@@ -107,21 +107,21 @@
<INITIAL>["][^nr"]*["] {
/* ENCAPSULATED TC_STRING */
/* eat trailing " */
yytext[yyleng-1]=0;
/* eat leading " */
yytext++;
cfglval->value.str.val = zend_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
+ cfglval->value.str.len = yyleng - 2;
cfglval->type = IS_STRING;
return TC_ENCAPSULATED_STRING;
}
<INITIAL>[&|~()!] {
return yytext[0];
}
<INITIAL>[^=nrt;|&~()!"]+ {
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6804