|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52138 Constants are parsed into the ini file for section names
Submitted: 2010-06-22 09:59 UTC Modified: 2010-06-25 00:32 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: acid24 at gmail dot com Assigned: felipe (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.3.2 OS: Red Hat Enterprise release 5.3
Private report: No CVE-ID: None
 [2010-06-22 09:59 UTC] acid24 at gmail dot com
Documentation at says "Constants may also be parsed in the ini file so if you define a constant as an ini value before running parse_ini_file(), it will be integrated into the results. Only ini values are evaluated.". 

I found this to be incomplete. Not only ini values are evaluated, but also section names.

Test script:
define( 'MYCONST', 1 );
test.ini file looks like this


$ret = parse_ini_file( 'test.ini', true );
var_dump( $ret );

Expected result:
array(1) {
  array(1) {
    string(1) "1"

Actual result:
array(1) {
  array(1) {
    string(1) "1"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-23 02:09 UTC]
-Status: Open +Status: Analyzed
 [2010-06-23 02:09 UTC]
For 5.3+ the constant value is passed directly to ZEND_INI_PARSER_CB(), thus not knowing its name...
 [2010-06-23 09:31 UTC] acid24 at gmail dot com
I don't think section names should be replaced by constant values, but since that's the case, the online documentation should be updated to document this fact.
 [2010-06-24 02:31 UTC]
I should not... as it can cause overwrite.
 [2010-06-25 00:32 UTC]
Automatic comment from SVN on behalf of felipe
Log: - Fixed bug #52138 (Constants are parsed into the ini file for section names)
 [2010-06-25 00:32 UTC]
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-06-25 00:32 UTC]
This bug has been fixed in SVN.

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 03:01:32 2024 UTC