Bug->Doc #81482 [Opn->Nab]: parse_ini_string behaves differently than on PHP 8.0-

[email protected]
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=81482&edit=1

 ID:                 81482
 Updated by:         [email protected]
 Reported by:        dseguy at exakat dot io
 Summary:            parse_ini_string behaves differently than on PHP
                     8.0-
-Status:             Open
+Status:             Not a bug
-Type:               Bug
+Type:               Documentation Problem
 Package:            Filesystem function related
 PHP Version:        8.1.0RC2
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

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>


Previous Comments:
------------------------------------------------------------------------
[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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.