php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6804 parse_ini_file is not handling quoted strings properly
Submitted: 2000-09-18 21:02 UTC Modified: 2000-11-09 05:01 UTC
From: alex at zend dot com Assigned:
Status: Closed Package: PHP options/info functions
PHP Version: 4.0.2 OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alex at zend dot com
New email:
PHP Version: OS:

 

 [2000-09-18 21:02 UTC] alex at zend dot 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>["][^\n\r"]*["] {
        /* 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>[^=\n\r\t;|&~()!"]+ {

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-09 05:01 UTC] hholzgra@php.net
the new ini parser in zend_ini_parser.l gets it right ...
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 16:01:43 2019 UTC