Edit report at https://bugs.php.net/bug.php?id=63512&edit=1
ID: 63512
Comment by: arjen at react dot com
Reported by: arjen at react dot com
Summary: parse_ini_file() with INI_SCANNER_RAW removes quotes
from value.
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: All
PHP Version: 5.3.18
Block user comment: N
Private report: N
New Comment:
Warning: expected result and actual result are swapped! :o
Previous Comments:
------------------------------------------------------------------------
[2012-11-14 11:53:41] arjen at react dot com
Description:
------------
An option value containing a constant followed by an quoted string is
transformed
in constant string: CONSTANT "string" => CONSTANT string
This is broken since 5.3.15/5.4.5, probably by fixing
https://bugs.php.net/bug.php?id=51094
See http://3v4l.org/VkQgF
And INI_SCANNER_RAW isn't really raw, as quotes are removed anyway.
For value = "string" I would expect array('value' => '"string"') as result, so
one can differentiate between value = "CONSTANT" and value = CONSTANT.
Test script:
---------------
<?php
define('INSTALL_ROOT', "meukee!");
$array = parse_ini_string('
int = 123
constant = INSTALL_ROOT
quotedString = "string"
a = INSTALL_ROOT "waa"
b = "INSTALL_ROOT"
c = "waa" INSTALL_ROOT
d = INSTALL_ROOT "INSTALL_ROOT"', false, INI_SCANNER_RAW);
var_dump($array);
Expected result:
----------------
array(7) {
["int"]=>
string(3) "123"
["constant"]=>
string(12) "INSTALL_ROOT"
["quotedString"]=>
string(6) "string"
["a"]=>
string(16) "INSTALL_ROOT waa"
["b"]=>
string(12) "INSTALL_ROOT"
["c"]=>
string(16) "waa INSTALL_ROOT"
["d"]=>
string(25) "INSTALL_ROOT INSTALL_ROOT"
}
Actual result:
--------------
array(7) {
["int"]=>
string(3) "123"
["constant"]=>
string(12) "INSTALL_ROOT"
["quotedString"]=>
string(6) "string"
["a"]=>
string(18) "INSTALL_ROOT "waa""
["b"]=>
string(12) "INSTALL_ROOT"
["c"]=>
string(18) ""waa" INSTALL_ROOT"
["d"]=>
string(27) "INSTALL_ROOT "INSTALL_ROOT""
}
even better:
array(7) {
["int"]=>
string(3) "123"
["constant"]=>
string(12) "INSTALL_ROOT"
["quotedString"]=>
string(6) ""string""
["a"]=>
string(18) "INSTALL_ROOT "waa""
["b"]=>
string(12) "INSTALL_ROOT"
["c"]=>
string(18) ""waa" INSTALL_ROOT"
["d"]=>
string(27) "INSTALL_ROOT "INSTALL_ROOT""
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63512&edit=1