Doc #81482 [Nab]: parse_ini_string behaves differently than on PHP 8.0-
[email protected] ("dseguy at exakat dot io")
| Newsgroups | php.doc.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=81482&edit=1
ID: 81482
User updated by: dseguy at exakat dot io
Reported by: dseguy at exakat dot io
Summary: parse_ini_string behaves differently than on PHP
8.0-
Status: Not a bug
Type: Documentation Problem
Package: Filesystem function related
PHP Version: 8.1.0RC2
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
OK, I missed it, it does apply here. Thanks.
Previous Comments:
------------------------------------------------------------------------
[2021-09-27 17:37:14] [email protected]
It seems to me that is already documented in the migration
guide[1] (and also in UPGRADING).
[1] <https://www.php.net/manual/en/migration81.other-changes.php#migration81.other-changes.ini>
------------------------------------------------------------------------
[2021-09-27 17:27:51] dseguy at exakat dot io
Description:
------------
Here is a simple string that yields an error on PHP 8.1 and nothing on PHP 8.0.
https://3v4l.org/Jg3Wu
I think the INI code should actually yield an error (the 4th " is actually not escaped) but it used to be processed without error in PHP 8.0 and older.
I could not find a mention of parse_ini_* update in the NEWS, so it might be collateral.
I suggest a mention of update in the migration manual will be good.
Test script:
---------------
<?php
$ini = <<<'INI'
code="
\"\\" value=\\"\" . htmlspecialchars($Value) . \"\\" />\n\";
";
INI;
print_r(parse_ini_string($ini));
Expected result:
----------------
Array
(
[code] =>
"\" value=\"" . htmlspecialchars($Value) . "\" />\n";
)
Actual result:
--------------
code="
\"\\" value=\\"\" . htmlspecialchars($Value) . \"\\" />\n\";
";PHP Warning: syntax error, unexpected '=' in Unknown on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81482&edit=1