#26325 [Fbk->Opn]: At least a notice when accessing private members in a derived class?
| From: | drm at melp dot nl | Date: | Wed, 17 Dec 2003 17:06:26 +0000 |
| Subject: | #26325 [Fbk->Opn]: At least a notice when accessing private members in a derived class? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52222@lists.php.net to get a copy of this message | ||
ID: 26325
User updated by: drm at melp dot nl
Reported By: drm at melp dot nl
-Status: Feedback
+Status: Open
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5.0.0b2 (beta2)
New Comment:
sniper >
I tried the snapshot (labeled PHP/5.0.0b3-dev), but the problem
persists.
Previous Comments:
------------------------------------------------------------------------
[2003-12-16 03:00:41] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
AFAICT, bug #26182 is fixed..so try the snapshot?
------------------------------------------------------------------------
[2003-11-26 11:07:13] drm at melp dot nl
J > Sorry i reacted that way, I misinterpreted your post.
I cannot reproduce what you mean in PHP4. Can you give an example?
I tried some stuff, but all the versions i tried gave expected results.
Changing "private $member" into "var $member" or removing that line
completely results in:
-----
Member contains: Test constructor, though getMember() says: Test
constructor?
Member contains: a, though getMember() says: a?
-----
which is logical, since the member will be public as soon as you
introduce it, both with "var $member" and removing the line completely
(and initializing it in the Test constructor). When removing the
initialization in the Test constructor, the same notice as in the other
codesample will be produced. (Notice: Undefined property: member in
....)
btw: i figure this hasn't got anything to do with the fact that I
tested on WinXP, maybe that should be changed to OS: irrelevant?
------------------------------------------------------------------------
[2003-11-24 11:28:58] jay@php.net
Take your original example and edit it so it works in PHP
4. It runs in both 4 and 5 without a notice. Based on your
original example code, that isn't "just plain bs."
Upon further inspection based on your second example,
there is definitely something weird going on here. This is
most likely related to #26182.
J
I'm not positive, but I think this may have something to
do with #26182.
J
------------------------------------------------------------------------
[2003-11-22 18:57:46] drm at melp dot nl
You are right, i hadn't researched the problem that well, since i
assumed php5 would treat properties the php4-style the same way as php4
itself. But you are right; the code sample above when ran in php5
doesn't give a notice, though php4 does.
------------------------------------------------------------------------
[2003-11-22 10:26:03] abies@php.net
Actually, the main issue here is that PHP doesn't give a notice at all
if you access an undefined property, whether it is a private property
in a base class or not.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/26325
--
Edit this bug report at http://bugs.php.net/?id=26325&edit=1