Re: parse_ini_file() seems to be broken in PHP 5.2.4-2ubuntu5.12
| From: | Tamara Temple | Date: | Thu, 11 Nov 2010 09:08:37 +0000 |
| Subject: | Re: parse_ini_file() seems to be broken in PHP 5.2.4-2ubuntu5.12 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309444@lists.php.net to get a copy of this message | ||
On Nov 10, 2010, at 8:08 PM, Daevid Vincent wrote:
http://php.net/manual/en/function.parse-ini-file.php Why doesn't PHP parse the 'null', 'true', 'false', etc into their proper equivalents? What's worse is that it does this mangling of my RAW values to be strings and sets them to "1" !!! WTF good does that do me?! Here is my test.ini file: --------------------------------------------------------------------------- ---------------------------Maybe I'm missing something, but i thought that's what the constants evaluated to....[examples] ; this is a section ; this is a comment linelog_level = E_ALL & ~E_NOTICE1 = intkey ; this is a int key nullvalue = null ; this is NULL truebool = true ; this is boolean (TRUE) falsebool = false ; this is boolean (FALSE) intvalue = -1 ; this is a integer (-1) floatvalue = +1.4E-3 ; this is a float (0.0014) stringvalue = Hello World ; this is a unquoted string quoted = "Hello World" ; this is a quoted string apostrophed = 'Hello World' ; this is a apostrophed string quoted escaped = "it work's \"fine\"!" ; this is a quoted string withescaped quotes apostrophed escaped = 'it work\'s "fine"!' ; this is a apostrophed string with escaped apostrophes --------------------------------------------------------------------------- --------------------------- Here is my test.php page: --------------------------------------------------------------------------- --------------------------- <?php var_dump(parse_ini_file('./test.ini', true)); ?> --------------------------------------------------------------------------- --------------------------- Here is the output: --------------------------------------------------------------------------- --------------------------- array 'examples' => array'log_level' => string '6135' (length=4) 1 => string 'intkey' (length=6) 'nullvalue' => string '' (length=0) 'truebool' => string '1' (length=1) 'falsebool' => string '' (length=0) 'intvalue' => string '-1' (length=2) 'floatvalue' => string '+1.4E-3' (length=7) 'stringvalue' => string 'Hello World' (length=11) 'quoted' => string 'Hello World' (length=11) 'apostrophed' => string ''Hello World'' (length=13) 'quoted escaped' => string 'it work's \fine\!' (length=17) 'apostrophed escaped' => string ''it work\'sfine' (length=15)--------------------------------------------------------------------------- --------------------------- developer@mypse:~$ php -v PHP 5.2.4-2ubuntu5.12 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 20 2010 13:18:10) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans