Bug #62884 [Asn->Csd]: parse_ini_file() results changed in 5.3.15
| From: | pierrick@php.net | Date: | Fri, 16 Nov 2012 23:52:47 +0000 |
| Subject: | Bug #62884 [Asn->Csd]: parse_ini_file() results changed in 5.3.15 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174772@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62884&edit=1
ID: 62884
Updated by: pierrick@php.net
Reported by: fidian at rumkin dot com
Summary: parse_ini_file() results changed in 5.3.15
-Status: Assigned
+Status: Closed
Type: Bug
Package: Unknown/Other Function
Operating System: Ubuntu Linus 12.04
PHP Version: 5.3Git-2012-08-21 (Git)
Assigned To: pierrick
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2012-08-22 05:43:54] laruence@php.net
Pierrick, do you have time to look into this? thanks
------------------------------------------------------------------------
[2012-08-21 23:50:18] fidian at rumkin dot com
For clarification, what Microsoft says is
If the string associated with lpKeyName is enclosed in single or double
quotation marks, the marks are discarded when the GetPrivateProfileString
function retrieves the string.
This leads me to believe that it merely checks if the first and last character
match and if they are a " or ' and then would remove both the first and last
character.
------------------------------------------------------------------------
[2012-08-21 23:48:41] fidian at rumkin dot com
Description:
------------
Given an INI file that looks like this
ini = "a"b"
and when you use parse_ini_file with INI_SCANNER_RAW, PHP used to return this as
array('ini' => 'a"b') and now returns it as array('ini' =>
'ab"'). This does
not appear to match with Microsoft's GetPrivateProfileString
(http://msdn.microsoft.com/en-us/library/ms724353(VS.85).aspx) where they say
that values which are quoted with either single or double quotes are simply
unquoted. My expected behavior would be to mirror the Microsoft parser,
especially when in raw mode.
Note: I am not talking about changing INI_SCANNER_NORMAL, just the raw mode so
I can get the unparsed values.
According to git-bisect, commit 4e6f27f4db6121e67f17906b27cc829120738b71 is the
culprit, but I suspect that the fix for bug 51094 is really to blame.
Test script:
---------------
<?php
error_reporting(0);
$result = parse_ini_string('ini = "a"b"', false, INI_SCANNER_RAW);
var_export($result);
echo "\n";
Expected result:
----------------
array (
'ini' => 'a"b',
)
Actual result:
--------------
array (
'ini' => 'ab"',
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62884&edit=1