Edit report at http://bugs.php.net/bug.php?id=52138&edit=1
ID: 52138 Updated by: fel...@php.net Reported by: acid24 at gmail dot com Summary: Constants are parsed into the ini file for section names -Status: Analyzed +Status: Closed Type: Bug Package: Filesystem function related Operating System: Red Hat Enterprise release 5.3 PHP Version: 5.3.2 -Assigned To: +Assigned To: felipe New Comment: 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 http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2010-06-25 00:32:47] fel...@php.net Automatic comment from SVN on behalf of felipe Revision: http://svn.php.net/viewvc/?view=revision&revision=300737 Log: - Fixed bug #52138 (Constants are parsed into the ini file for section names) ------------------------------------------------------------------------ [2010-06-24 02:31:09] fel...@php.net I should not... as it can cause overwrite. ------------------------------------------------------------------------ [2010-06-23 09:31:50] 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-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