php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49692 parse_ini_file() throws errors when key contains '/' (forward slash)
Submitted: 2009-09-27 21:58 UTC Modified: 2009-09-29 13:55 UTC
From: rickwalker2001 at gmail dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.3.0 OS: OS X 10.6
Private report: No CVE-ID:
 [2009-09-27 21:58 UTC] rickwalker2001 at gmail dot com
Description:
------------
When parsing ini files if the key contains a '/' char a syntax error is 
thrown.

I have seen a bug closed as bogus from back in feb on one of the 5.3 
beta versions but I am seeing this with the latest stable 5.3 build from 
macports.

PHP 5.3.0 (cli) (built: Sep 26 2009 00:08:23) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
    with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans


Reproduce code:
---------------
//my.ini file
[sitemap]
/home    = default:index
/info    = default:info

print_r(parse_ini_file('my.ini', true));

Expected result:
----------------
Array
(

    [sitemap] => Array
        (
            [/home] => default:index
            [/info] => default:info
        )

)

Actual result:
--------------
PHP Warning:  syntax error, unexpected '/' in my.ini on line 2
 in /Users/rick/test.php on line 5
PHP Stack trace:
PHP   1. {main}() /Users/rick/test.php:0
PHP   2. parse_ini_file() /Users/rick/test.php:5

Warning: syntax error, unexpected '/' in my.ini on line 2
 in /Users/rick/test.php on line 5

Call Stack:
    0.0004     622136   1. {main}() /Users/rick/test.php:0
    0.0004     622312   2. parse_ini_file() /Users/rick/test.php:5


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-27 22:43 UTC] rickwalker2001 at gmail dot com
Previous bug: http://bugs.php.net/bug.php?id=47332
 [2009-09-28 07:00 UTC] jani@php.net
Like I said in that other report: It's already fixed (in SVN :).
 [2009-09-28 07:30 UTC] rickwalker2001 at gmail dot com
Cheers for getting back.  So, slightly confused as to how a bug fixed in 
a beta version back in February is in SVN but has not made it into the 
stable build yet?

*Off to familiarise myself with your SVN policy - thanks for the prompt 
reply. :-)
 [2009-09-28 11:59 UTC] rickwalker2001 at gmail dot com
Sorry Jani - but having asked on php-qa about how a bug fixed in a prior 
beta version is still present in a subsequent stable release they have 
advised that I re-comment on this bug.

Can you please test this for yourself on the 5.3.0 build.  I would 
assume that if the bug was fixed on 5.3.0beta1 back in February that it 
would have made up part of the 5.3.0 stable release.  Am I wrong on 
this?  Saying - 'Its fixed in SVN' does not help really as it's unclear.

Basically - this bug is still on 5.3.0 (which presumably is built from 
SVN).
 [2009-09-28 12:47 UTC] jani@php.net
It was quite likely fixed after 5.3.0 was released. Even if something is reported for some version, it does not mean it will be fixed in the next version..
 [2009-09-28 13:08 UTC] rickwalker2001 at gmail dot com
Erm, really not following.  PHP 5.3.0 was released 30th June 2009.  You 
reported this as being 'fixed' on version php 5.3.0beta1 on the 8th 
February 2009.
 [2009-09-28 22:57 UTC] svn@php.net
Automatic comment from SVN on behalf of rdohms
Revision: http://svn.php.net/viewvc/?view=revision&revision=288922
Log: Adding tests for bug #49692
 [2009-09-29 13:42 UTC] rdohms@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Confirmed to be fixed in SVN for next release (5.3.1)
 [2009-09-29 13:55 UTC] rickwalker2001 at gmail dot com
Much appreciated.  I built from snap last and this has solved this for me.

Thanks again for your prompt attention on this.

HTH, Rick.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Thu Aug 17 11:01:43 2017 UTC