Bug #52138 [Opn->Ana]: Constants are parsed into the ini file for section names

From: Date: Wed, 23 Jun 2010 00:09:58 +0000
Subject: Bug #52138 [Opn->Ana]: Constants are parsed into the ini file for section names
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151783@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52138&edit=1

 ID:               52138
 Updated by:       felipe@php.net
 Reported by:      acid24 at gmail dot com
 Summary:          Constants are parsed into the ini file for section
                   names
-Status:           Open
+Status:           Analyzed
 Type:             Bug
 Package:          Filesystem function related
 Operating System: Red Hat Enterprise release 5.3
 PHP Version:      5.3.2

 New Comment:

For 5.3+ the constant value is passed directly to ZEND_INI_PARSER_CB(),
thus not knowing its name...


Previous Comments:
------------------------------------------------------------------------
[2010-06-22 09:59:06] acid24 at gmail dot com

Description:
------------
Documentation at
http://www.php.net/manual/en/function.parse-ini-file.php
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

[MYCONST]
MYCONST = MYCONST

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

Expected result:
----------------
array(1) {
  ["MYCONST"]=>
  array(1) {
    ["MYCONST"]=>
    string(1) "1"
  }
}

Actual result:
--------------
array(1) {
  [1]=>
  array(1) {
    ["MYCONST"]=>
    string(1) "1"
  }
}


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52138&edit=1


Thread (5 messages)

« previous php.bugs (#151783) next »