From:             eric dot caron at gmail dot com
Operating system: N/A
PHP version:      5.3.0
PHP Bug Type:     Filesystem function related
Bug description:  Special characters in section name breaks parse_ini_file

Description:
------------
PHP 5.3 changes to parse_ini_*() functions breaks scripts that have
special characters, {}|&~![()^", in the section titles. (Previous versions
worked, which I assume was proper behavior because section titles can have
those characters according to community understood INI standards).

There is no documentation stating that special characters can not be used
in section titles. While the INI_SCANNER_RAW parameter provides an opening
for a workaround for this solution, to be useful, the characters
{}|&~![()^" should be usable in section titles (not to be confuse with
keys, where they shouldn't be used).

Reproduce code:
---------------
<?php
$tmpfname = tempnam("/tmp", "FOO");
file_put_contents($tmpfname, '[Ask]
Crawler=true

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]
Crawler=true
');

$array = parse_ini_file($tmpfname, true);
print_r($array);
unlink($tmpfname);

Expected result:
----------------
Array
(
    [Ask] => Array
        (
            [Crawler] => 1
        )

    [Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)] => Array
        (
            [Crawler] => 1
        )

)


Actual result:
--------------
Warning: parse error, expecting `']'' in FOOFCCA.tmp on line 4 in
parseBug.php on line 10 

-- 
Edit bug report at http://bugs.php.net/?id=49443&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49443&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49443&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49443&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49443&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49443&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49443&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49443&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49443&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49443&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49443&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49443&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49443&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49443&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49443&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49443&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49443&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49443&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49443&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49443&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49443&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49443&r=mysqlcfg

Reply via email to