|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44442 parse_ini_file crashes on "(" or ")"
Submitted: 2008-03-15 10:33 UTC Modified: 2008-03-17 00:21 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: VJTD3 at VJTD3 dot com Assigned:
Status: Wont fix Package: Filesystem function related
PHP Version: 5.2.5 OS: any
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.
Block user comment
Status: Assign to:
Bug Type:
From: VJTD3 at VJTD3 dot com
New email:
PHP Version: OS:


 [2008-03-15 10:33 UTC] VJTD3 at VJTD3 dot com
if a ini file has a "(" or ")" in it the parse_ini_file function will end on the character before the "(" or ")". in some cases or remove the "(" and ")" or just dump everything between the "(" and ")".

In a nut shell it hates "(" and ")" for some reason.

Reproduce code:
sample "demo.ini" file:


php -r "print_r(parse_ini_file('demo.ini', true));"

Expected result:
    [demo] => Array
            [a] => 1
            [b] => (
            [c] => 3


Actual result:
Warning: Error parsing demo.ini on line 3
    [demo] => Array
            [a] => 1
            [b] =>



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-15 13:13 UTC]
Says the documentation:

"Note: If a value in the ini file contains any non-alphanumeric characters it needs to be enclosed in double-quotes (")."

"... Characters {}|&~![()" must not be used anywhere in the key and have a special meaning in the value."

 [2008-03-15 13:49 UTC] VJTD3 at VJTD3 dot com
real files in real use in the real world don't go by that variation. anything right of the = is treated as plain text. there needs to be at bare minimum a flag to turn off the double quotes requirement. One example being the editing of third part programs where you can't just introduce double quotes and not have things break.
 [2008-03-17 00:21 UTC]
This has been like this for years. The ini file has certain syntax, live with it.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 03:01:29 2024 UTC