php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78645 Upgrading notes are missing a note about default empty objects
Submitted: 2019-10-08 12:13 UTC Modified: 2019-11-07 10:49 UTC
From: phofstetter at sensational dot ch Assigned: nikic (profile)
Status: Closed Package: Documentation problem
PHP Version: 7.4.0RC3 OS: macOS, Linux
Private report: No CVE-ID: None
 [2019-10-08 12:13 UTC] phofstetter at sensational dot ch
Description:
------------
When testing our codebase with PHP 7.4, I noticed that some third-party library (Smarty) was relying on broken behavior of PHP versions prior to 7.4 that was apparently fixed in 7.4:

Prior to 7,4 only the second line of the test script would throw a warning. In 7.4, both lines throw a warning.

    <?php

    $foo=null; $foo->bar = "baz"; // does throw warning in <7.4
    $foo=null; $foo->bar["baz"] = "baz"; // doesn't throw warning in <7.4

I'm not asking for the old obviously broken behavior to be restored, but seeing that some still somewhat widely used piece of software is relying on this bug, it may make sense to add a note to the UPGRADING.txt file.

Test script:
---------------
<?php

$foo=null; $foo->bar = "baz"; // does throw warning
$foo=null; $foo->bar["baz"] = "baz"; // doesn't throw warning

Expected result:
----------------
one warning

Actual result:
--------------
two warnings

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-08 12:16 UTC] phofstetter at sensational dot ch
when I said

> Prior to 7,4 only the second line of the test script would throw a warning

I meant

> Prior to 7,4 only the *first* line of the test script would throw a warning
 [2019-10-13 15:10 UTC] cmb@php.net
Well, this has be treated as bug(-fix)[1], and as such has only a
mention in NEWS.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=e63febb1c772e15c1da891f00e3a343090e43c67>
 [2019-11-07 10:49 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC