php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #33873 parse_ini_file() bails out with parse error when "NO" is inside file
Submitted: 2005-07-26 21:59 UTC Modified: 2005-08-04 10:58 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: eric at aplosmedia dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.0.4 OS: Windows XP; RHEL 3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 - 36 = ?
Subscribe to this entry?

 
 [2005-07-26 21:59 UTC] eric at aplosmedia dot com
Description:
------------
If an INI file contains a definition such as NO = 667, php will bail out with a parse error.

Warning: Error parsing /home/public_html/lookup.ini on line 147 in /home/public_html/start.php on line 24

This occurs on PHP 5.0.4 on Windows XP, RHEL 3  as well as php 4.3.11 on RHEL 3 (only platforms tested)

Reproduce code:
---------------
lookup.ini
====================

; NETHERLANDS
NL = 31

; NORWAY
NO = 47

; NEW ZEALAND
NZ = 64


PHP
====================

<?php print_r( parse_ini_file( './lookup.ini' ) ); ?>

Expected result:
----------------
should return an array:

Array
(
    [NL] => 31
    [NO] => 47
    [NZ] => 64
}

Actual result:
--------------
Warning: Error parsing /home/public_html/lookup.ini on line 147 in /home/public_html/start.php on line 24

Array
(
    [NL] => 31
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-26 22:10 UTC] tony2001@php.net
no, on, off, yes, true, false, none are reserved words.
That should be documented somewhere.
 [2005-07-27 10:54 UTC] eric at aplosmedia dot com
Im aware that these are reserved words, but I wasn't able to find anything in the documentation that outlines this behavior...
 [2005-08-04 10:58 UTC] vrana@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate to bug #22923 and fixed on 2003/04/01:

"There are reserved words which must not be used as keys for ini files. These include: null, yes, no, true, and false."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 02:01:31 2024 UTC