php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75921 Inconsistent: No warning in some cases when stdObj is created on the fly
Submitted: 2018-02-05 17:30 UTC Modified: -
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: sp at fp dot de Assigned:
Status: Closed Package: Class/Object related
PHP Version: 7.2.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 - 6 = ?
Subscribe to this entry?

 
 [2018-02-05 17:30 UTC] sp at fp dot de
Description:
------------
On accessing non-existing properties on an object PHP under some circumstances produces an instance of stdObj on the fly.

In most cases a warning is produced: "Creating default object from empty value"

The warning is missing, if array-syntax is used:

class test {}
$test = new test();
$test->foo->bar['nope'] = 42;

Test script:
---------------
https://3v4l.org/aakSR


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-14 11:56 UTC] nikic@php.net
Automatic comment on behalf of dave@mudsite.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e63febb1c772e15c1da891f00e3a343090e43c67
Log: Fixed bug #75921
 [2019-02-14 11:56 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC