Edit report at https://bugs.php.net/bug.php?id=62884&edit=1

 ID:                 62884
 User updated by:    fidian at rumkin dot com
 Reported by:        fidian at rumkin dot com
 Summary:            parse_ini_file() results changed in 5.3.15
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Ubuntu Linus 12.04
 PHP Version:        5.3Git-2012-08-21 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to