php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41445 parse_ini_file function has a problem with certain types of integer as sections
Submitted: 2007-05-19 22:42 UTC Modified: 2007-08-02 14:33 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dcox at conxxus dot com Assigned: tony2001 (profile)
Status: Closed Package: PHP options/info functions
PHP Version: 5.2.2 OS: linux 2.4.32
Private report: No CVE-ID: None
 [2007-05-19 22:42 UTC] dcox at conxxus dot com
Description:
------------
I stumbled across this when storing MAC configuration in an INI file.
When the MAC address (length=12) had all numbers and started with "00" then the MAC would not be stored as a section correctly.

Reproduce code:
---------------
<?php
$options = parse_ini_file("test.ini", TRUE);
print_r($options);
?>

-- test.ini --
[001099030277]
option1 = yes

[011099030277]
option2 = yes



Expected result:
----------------
Array
(
    [001099030277] => Array
        (
            [option1] => 1
        )

    [011099030277] => Array
        (
            [option2] => 1
        )

)

Actual result:
--------------
Array
(
    [8] => Array
        (
            [option1] => 1
        )

    [011099030277] => Array
        (
            [option2] => 1
        )

)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-26 12:10 UTC] tony2001@php.net
This bug has been fixed in CVS.

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.


 [2007-08-02 14:33 UTC] philip@php.net
FWIW, this bug also exists (and was documented) via:

http://bugs.php.net/bug.php?id=29306

The documentation will be updated to reflect the new fixed behaviour.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC