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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC