php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54974 parse_ini_file() does not handle parens in property values
Submitted: 2011-06-02 04:13 UTC Modified: 2011-06-02 05:00 UTC
From: dhendric at adobe dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.17 OS: RHEL 5
Private report: No CVE-ID: None
 [2011-06-02 04:13 UTC] dhendric at adobe dot com
Description:
------------
---
From manual page: http://www.php.net/function.parse-ini-file#Description
---

Using parse_ini_file() on a ini files that contain parens () in the property values throws and error.

Example of Test.ini file:
#S7Z OK
#Wed Jun 01 18:58:52 PDT 2011
copyright=Copyright (c) 2001-2010 Adobe Systems Incorporated. All rights reserved.
imageServer.buildDate=Mon Apr 25 02:18:36 PDT 2011
imageServer.startTime=Mon Apr 25 16:10:52 PDT 2011
imageServer.version=4.9.2

Test script:
---------------
print_r(parse_ini_file("Test.ini"));

Expected result:
----------------
The parse_ini_file() should process any character in the property value else what good is it.

Actual result:
--------------
Warning: syntax error, unexpected '(' in Test.ini on line 3 in /opt/lampp/htdocs/working_deirdra/serverlist/serverlist_ajax.php on line 82

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-02 05:00 UTC] dtajchreber@php.net
-Status: Open +Status: Bogus
 [2011-06-02 05:00 UTC] dtajchreber@php.net
Quote free text like that.

[david@oslo:~]$ cat t.php 
<?php

$ini = <<<INI
copyright="Copyright (c) 2001-2010 Adobe Systems Incorporated. All rights"
INI;

var_dump(parse_ini_string($ini));

[david@oslo:~]$ php t.php 
array(1) {
  ["copyright"]=>
  string(62) "Copyright (c) 2001-2010 Adobe Systems Incorporated. All rights"
}
[david@oslo:~]$
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 30 18:00:02 2025 UTC