php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50295 no notice on undefined property access
Submitted: 2009-11-25 17:00 UTC Modified: 2009-11-25 17:33 UTC
From: ies_clan at hotmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.3SVN-2009-11-25 (snap) OS: Windows XP SP3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ies_clan at hotmail dot com
New email:
PHP Version: OS:

 

 [2009-11-25 17:00 UTC] ies_clan at hotmail dot com
Description:
------------
if u try to acccess an property from a class that doesn't exists it throws a notice, but if u set a value to this property und then u try to access its ok... but that should ony if there is a __set / __get method in that class

Reproduce code:
---------------
class test{}
$test = new test();
echo $test->bla;
<-- throws a notice: ok

class test{
 public function __set($Key, $Value){...}
 public function __get($Key){...}
}
$test = new test();
$test->bla = 'aaa';
echo $test->bla;
<-- throws nothing: ok

class test{}
$test = new test();
$test->bla = 'aaa';
echo $test->bla;
<-- throws nothing: not ok

Expected result:
----------------
first: Notice: Undefined property bla
second: 
third: Notice: Undefined property bla

Actual result:
--------------
first: Notice: Undefined property bla
second: 
third:

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-25 17:33 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Mar 12 11:01:32 2025 UTC