|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28804 [FIX] lex pattern for ini-file sections wrong (affects php.ini/parse_ini_file())
Submitted: 2004-06-16 14:20 UTC Modified: 2005-02-03 04:02 UTC
Avg. Score:3.9 ± 1.1
Reproduced:7 of 9 (77.8%)
Same Version:4 (57.1%)
Same OS:2 (28.6%)
From: wendland at scan-plus dot de Assigned: zeev
Status: Closed Package: Scripting Engine problem
PHP Version: 4CVS, 5CVS OS:
Private report: No CVE-ID:
 [2004-06-16 14:20 UTC] wendland at scan-plus dot de
The pattern for section in ini-files (as used in php.ini and each file used with parse_ini_file()) is wrong.  It looks like (in Zend/zend_ini_scanner.l:140):

<INITIAL>[[][^[]+[\]][ ]*{NEWLINE}? 

That means that the following example won't work:

var = "val"
var2 = "]"
var3 = "val3"

Try to run this through parse_ini_file(). The pattern should look like:

<INITIAL>\[[^\]]+\][ ]*{NEWLINE}? 

If you'd like to disallow brackets in section name, you could use the following pattern:

<INITIAL>\[[^\]\[]+\][ ]*{NEWLINE}?

Kind Regards,
  Joerg Wendland


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-06 15:55 UTC]
Assigned to the author.

 [2004-12-13 01:33 UTC]
Zeev, please look into this sometime, or at least add a comment if you're not going to do it?

 [2005-02-03 04:02 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 17:01:32 2015 UTC