#47476 [NEW]: "Internally overloading" null properties
| From: | nullhility at gmail dot com | Date: | Sun, 22 Feb 2009 17:30:33 +0000 |
| Subject: | #47476 [NEW]: "Internally overloading" null properties | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-134090@lists.php.net to get a copy of this message | ||
From: nullhility at gmail dot com
Operating system:
PHP version: 5.2.8
PHP Bug Type: Feature/Change Request
Bug description: "Internally overloading" null properties
Description:
------------
I was attempting to overload some object members when I came to the
realization that members defined as unaccessible from inside an object are
ones that have not been initialized at all. I was attempting to call a
defined but not yet set private member from a method in the class, I
expected the __get definition to execute and hopefully do a late member
cast but PHP saw it as accessible, this caused a problem because the method
was calling a NULL value.
The way I see it is that a NULL, aside from still being a value itself, is
pretty inaccessible as an actual value. My main concern is that calling an
undefined member returns NULL but is also defined as inaccessible, yet
calling a defined (but unset/not set) private/protected from within the
object, though returning null, is accessible.
In the end I know it's about scope and correctness, but is this issue up
for change?
Reproduce code:
---------------
http://nullhility.pastebin.com/m486cded3
Expected result:
----------------
Hello World!
Hello Universe!
Hello Everyone!
Actual result:
--------------
Hello World!
Hello Everyone!
--
Edit bug report at http://bugs.php.net/?id=47476&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47476&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47476&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47476&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47476&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47476&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47476&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47476&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47476&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47476&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47476&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47476&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47476&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47476&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47476&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47476&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47476&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47476&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47476&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47476&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47476&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47476&r=mysqlcfg