php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50952 allow underscore _ in constants parsed in php.ini files
Submitted: 2010-02-07 08:55 UTC Modified: 2010-02-07 11:40 UTC
From: noemail at example dot org Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.3.1 OS: CentOS 5
Private report: No CVE-ID: None
 [2010-02-07 08:55 UTC] 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.
        )

)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-07 09:37 UTC] jani@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 10:01 UTC] noemail at example dot org
Sorry, the problem still occurs in the latest snapshot (php5.3-201002070930)
 [2010-02-07 11:40 UTC] svn@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 11:40 UTC] jani@php.net
Simply remove the __ from the constant name and it works with current  PHP versions. Will be fixed in future. :)
 [2010-02-07 12:08 UTC] svn@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=294698
Log: - Fixed bug #50952 (allow underscore _ in constants parsed in php.ini files)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC