ID:               50952
 Updated by:       j...@php.net
-Summary:          parse_ini_file() not parsing constants
 Reported By:      noemail at example dot org
-Status:           Open
+Status:           Closed
 Bug Type:         Filesystem function related
 Operating System: CentOS 5
 PHP Version:      5.3.1
 New Comment:

Simply remove the __ from the constant name and it works with current 
PHP versions. Will be fixed in future. :)


Previous Comments:
------------------------------------------------------------------------

[2010-02-07 11:40:29] s...@php.net

Automatic comment from SVN on behalf of jani
Revision: http://svn.php.net/viewvc/?view=revision&revision=294695
Log: -  Fixed bug #50952 (allow underscore _ in constants parsed in
php.ini files)

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

[2010-02-07 10:01:42] noemail at example dot org

Sorry, the problem still occurs in the latest snapshot
(php5.3-201002070930)

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

[2010-02-07 09:37:22] j...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

IIRC, this was fixed long time ago in SVN repo.

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

[2010-02-07 08:55:41] noemail at example dot org

Description:
------------
parse_ini_file() is not parsing constants that begin with an
underscore.

CentOS 5 / PHP 5.3.1 from source

Note: This did work as expected in PHP 5.1.6

Reproduce code:
---------------
##### ini.ini #####
[section]
key1 = "no error"
key2buggy = __STRING
key3buggy = __STRING" stays mainly on the plain."

##### test.php #####
<?php
define('__STRING', 'The rain in Spain');
$arr = parse_ini_file('./ini.ini');
print_r($arr);

Expected result:
----------------
Array
(
    [section] => Array
        (
            [key1] => no error
            [key2buggy] => The rain in Spain
            [key3buggy] => The rain in Spain stays mainly on the
plain.
        )

)

Actual result:
--------------
Array
(
    [section] => Array
        (
            [key1] => no error
            [key2buggy] => __STRING
            [key3buggy] => __STRING stays mainly on the plain.
        )

)


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


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

Reply via email to