php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26176 parse_ini_file elements bug
Submitted: 2003-11-08 07:59 UTC Modified: 2003-11-09 23:11 UTC
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:2 (50.0%)
From: glox at glox dot be Assigned:
Status: Closed Package: *General Issues
PHP Version: 5CVS-2003-11-08 (dev) OS: linux slackware 9.0
Private report: No CVE-ID: None
 [2003-11-08 07:59 UTC] glox at glox dot be
Description:
------------
When I load a .ini file with parse_ini_file and try to echo the elements of the array it won't work. The values show up on print_r/var_dump but can't be echo'd seperately. When I use foreach it finds the elements too. I tried the same script in php4 on the same pc and it worked fine.

Reproduce code:
---------------
# phpbug.php 
<?php 
$conf = parse_ini_file('config.ini', TRUE); 
print_r($conf); 
print_r($conf['clientports']); 
var_dump($conf['clientports'][0]); 
?> 

# config.ini 
; PHPIRCD Configuration File 

; Client ports: you can specify up to 10 ports here, start with 0 
[clientports] 
0 = 6667 
1 = 6668 

; Server ports: you can specify up to 10 ports here, start with 0 
[serverports] 
0 = 4041 

Expected result:
----------------
Array 
( 
    [clientports] => Array 
        ( 
            [0] => 6667 
            [1] => 6668 
        ) 

    [serverports] => Array 
        ( 
            [0] => 4041 
        ) 

) 
Array 
( 
    [0] => 6667 
    [1] => 6668 
) 
NULL 

Actual result:
--------------
Array 
( 
    [clientports] => Array 
        ( 
            [0] => 6667 
            [1] => 6668 
        ) 

    [serverports] => Array 
        ( 
            [0] => 4041 
        ) 

) 
Array 
( 
    [0] => 6667 
    [1] => 6668 
) 
string(4) "6667"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-09 23:11 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC