|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51982 Unexpected TC_SECTION with parse_ini_file/string
Submitted: 2010-06-02 22:58 UTC Modified: 2010-12-01 15:35 UTC
Avg. Score:4.0 ± 1.0
Reproduced:11 of 11 (100.0%)
Same Version:2 (18.2%)
Same OS:2 (18.2%)
From: uramihsayibok at gmail dot com Assigned:
Status: Open Package: PHP options/info functions
PHP Version: * OS: Win 7
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: uramihsayibok at gmail dot com
New email:
PHP Version: OS:


 [2010-06-02 22:58 UTC] uramihsayibok at gmail dot com
parse_ini_file and parse_ini_string can't handle arrays with multiple dimensions.

Test script:

$ini = <<<INI
a[b] = "c"
d[e][f] = "g" ; line 2



Expected result:
An appropriate var_dump

Actual result:
PHP Warning: syntax error, unexpected TC_SECTION, expecting '=' in Unknown on line 2

(or the INI filename instead of "Unknown" when using parse_ini_file)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-28 19:04 UTC]
-Type: Bug +Type: Feature/Change Request -PHP Version: 5.3.2 +PHP Version: *
 [2010-12-01 15:35 UTC]
-Package: Filesystem function related +Package: PHP options/info functions
 [2012-02-27 11:55 UTC] info at maartendeboer dot net
I recommend implementing this the Zend Framework way using '.' as separator for multi dimension "arrays".

[section][] = "a"

would then result in:

 - foo
  - bar
   - 0 = "a"
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 05:01:28 2024 UTC