parse_ini_file() seems to be broken in PHP 5.2.4-2ubuntu5.12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
---------------------------------------------------------------------------
---------------------------
[examples]                                  ; this is a section
                                            ; this is a comment line
log_level = E_ALL & ~E_NOTICE 
1 = 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 with
escaped 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux