php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81482 parse_ini_string behaves differently than on PHP 8.0-
Submitted: 2021-09-27 17:27 UTC Modified: 2021-09-27 17:44 UTC
From: dseguy at exakat dot io Assigned: cmb (profile)
Status: Not a bug Package: Filesystem function related
PHP Version: 8.1.0RC2 OS:
Private report: No CVE-ID: None
 [2021-09-27 17:27 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-27 17:37 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2021-09-27 17:37 UTC] cmb@php.net
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:44 UTC] dseguy at exakat dot io
OK, I missed it, it does apply here. Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC