Edit report at http://bugs.php.net/bug.php?id=52138&edit=1
ID: 52138 Comment by: acid24 at gmail dot com Reported by: acid24 at gmail dot com Summary: Constants are parsed into the ini file for section names Status: Analyzed Type: Bug Package: Filesystem function related Operating System: Red Hat Enterprise release 5.3 PHP Version: 5.3.2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2010-06-23 02:09:57] fel...@php.net For 5.3+ the constant value is passed directly to ZEND_INI_PARSER_CB(), thus not knowing its name... ------------------------------------------------------------------------ [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