php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33010 protected member array treated as static
Submitted: 2005-05-11 22:58 UTC Modified: 2005-05-11 23:24 UTC
From: bart dot vanbrabant at zoeloelip dot be Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.4 OS: Linux 2.6.11
Private report: No CVE-ID: None
 [2005-05-11 22:58 UTC] bart dot vanbrabant at zoeloelip dot be
Description:
------------
When using the __get and __set function and extending from a class the variable of the super class is treated static. The description isn't very clear but the source code explains it better.

It seems like the super class of the sub class uses a static member or that the same object is used.

Reproduce code:
---------------
The code snippit is a bit to long (~50lines):
http://zoeloelip.be:81/ea/tests/get_set.php.txt (the code)
http://zoeloelip.be:81/ea/tests/get_set.php (the output)

The server runs php 5.0.3 but on my machine with php 5.0.4 it also gives this error.

Expected result:
----------------
super::__construct
super: __get
$test at super construction: 10
super: __get
super: __set
super: __get
The value of 'test' is 11
-----------------------------------------
super::__construct
sub: __get
$test at super construction: 10
sub::__construct
sub: __get
$test at sub construction: 10
sub: __get
sub: __set
sub: __get
The value of 'test' in sub::super is 11

Actual result:
--------------
super::__construct
super: __get
$test at super construction: 10
super: __get
super: __set
super: __get
The value of 'test' is 11
------------------------------------------
sub::__construct
sub: __get
$test at sub construction: 11
sub: __get
sub: __set
sub: __get
The value of 'test' in sub::super is 12

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-11 23:06 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

Can't reproduce it.
 [2005-05-11 23:24 UTC] bart dot vanbrabant at zoeloelip dot be
Seems like this is fixed in 5.0.5-dev
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Aug 10 10:00:03 2025 UTC