php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48769 parse_ini_file() equal sign issue with INI_SCANNER_RAW
Submitted: 2009-07-02 07:12 UTC Modified: 2009-07-22 20:35 UTC
From: aharvey@php.net Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.3CVS-2009-07-02 (CVS) OS: Linux x86
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: aharvey@php.net
New email:
PHP Version: OS:

 

 [2009-07-02 07:12 UTC] aharvey@php.net
Description:
------------
In addition to bug 48768, which is a parse_ini_file() crasher when INI_SCANNER_RAW mode is used, there's also an issue with configuration items containing equal signs in general which results in a (seemingly) spurious warning.

Given that INI_SCANNER_RAW is new and only minimally documented, this may in fact be intended behaviour, in which case this should probably be changed to a documentation problem. It would seem odd that changing the scanner mode would prevent properly double-quoted configuration values from being parsed, though.

Reproduce code:
---------------
INI file:

equal = "foo=bar"


PHP script:

$ini = parse_ini_file('equals.ini', false, INI_SCANNER_NORMAL);
var_dump($ini);

$ini = parse_ini_file('equals.ini', false, INI_SCANNER_RAW);
var_dump($ini);


Expected result:
----------------
array(1) {
  ["equal"]=>
  string(7) "foo=bar"
}
array(1) {
  ["equal"]=>
  string(7) "foo=bar"
}


Actual result:
--------------
array(1) {
  ["equal"]=>
  string(7) "foo=bar"
}

Warning: syntax error, unexpected '"' in equals.ini on line 1
 in /tmp/equals.php on line 5

Call Stack:
    0.0007     324132   1. {main}() /tmp/equals.php:0
    0.0012     324544   2. parse_ini_file() /tmp/equals.php:5


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-07 17:11 UTC] jani@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.

The issue is same as in bug #48768
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 04:01:38 2024 UTC