|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-10-03 09:34 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2018-10-03 09:34 UTC] cmb@php.net
[2018-10-03 11:15 UTC] cmb@php.net
-Summary: parse_ini_file, parse_ini_string INI_SCANNER_RAW and
inline comments
+Summary: INI_SCANNER_RAW doesn't strip trailing whitespace
[2018-10-03 11:15 UTC] cmb@php.net
[2018-10-08 13:39 UTC] cmb@php.net
[2018-10-09 05:29 UTC] pierrick@php.net
[2018-10-09 05:29 UTC] pierrick@php.net
-Status: Verified
+Status: Closed
[2018-10-09 05:29 UTC] pierrick@php.net
[2018-10-09 05:29 UTC] pierrick@php.net
[2018-10-09 05:29 UTC] pierrick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ When a line contains a comment after the value, parse_ini_string and parse_ini_file in INI_SCANNER_RAW mode pass double quotes and optionally spaces into the value, but strip the semicolon and comment. Logically, if inline comments (comments not taking the whole line) are supported, they should be stripped before parsing the values. If such comments are not supported, they should be included into the value. If this is normal and expected behaviour, it should be documented. Test script: --------------- <?php $ini = <<<END [section] 1="Hello" 2="Hello" ; comment END; var_dump(parse_ini_string($ini,true,INI_SCANNER_RAW)); $tmp = tempnam('.','tmp'); file_put_contents($tmp,$ini); var_dump(parse_ini_file($tmp,true,INI_SCANNER_RAW)); unlink($tmp); Expected result: ---------------- Expecting either to elements 1 and 2 with the same value, or element 2 containing the inline comment if inline comments are not supported. Actual result: -------------- array(1) { ["section"]=> array(2) { [1]=> string(5) "Hello" [2]=> string(8) ""Hello" " } }