php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55260 parse_ini_file breaks with ampersand
Submitted: 2011-07-21 11:48 UTC Modified: 2011-07-21 14:35 UTC
From: austinb at inn-soft dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: Irrelevant OS: ubuntu4.9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: austinb at inn-soft dot com
New email:
PHP Version: OS:

 

 [2011-07-21 11:48 UTC] austinb at inn-soft dot com
Description:
------------
With an ampersand in the commented section of code, it crashes the function, 
always returns false.

Test script:
---------------
INI FILE
//-- SETUP FEE, INCLUDES LICENSE FOR HBP & TIME TO INSTALL IT
setupFee="79.99";

PHP
var_dump(parse_ini_file('./packageInfo.ini'));

RETURN
bool(false)

INI FILE
//-- SETUP FEE, INCLUDES LICENSE FOR HBP AND TIME TO INSTALL IT
setupFee="79.99";

PHP
var_dump(parse_ini_file('./packageInfo.ini'));

RETURN
array(1) { ["setupFee"]=> string(5) "79.99" }


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-21 14:35 UTC] aharvey@php.net
-Status: Open +Status: Bogus -Package: Unknown/Other Function +Package: Filesystem function related
 [2011-07-21 14:35 UTC] aharvey@php.net
INI comments start with a semi-colon (;), not //. As a result, that line gets 
parsed like any other INI directive, and it's an invalid one, hence the error.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 23:01:32 2025 UTC