#30451 [NEW]: static properties don't work properly

From: Date: Fri, 15 Oct 2004 23:50:55 +0000
Subject: #30451 [NEW]: static properties don't work properly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67638@lists.php.net to get a copy of this message
From:             guth at fiifo dot u-psud dot fr
Operating system: Linux
PHP version:      5.0.2
PHP Bug Type:     Zend Engine 2 problem
Bug description:  static properties don't work properly

Description:
------------
hello,

Yet another strange behaviour in PHP...

My english is always too bad to explain the problem, so have a look to the
following code...

Reproduce code:
---------------
<?php

class A {

	protected static $property = TRUE;
	
	protected static function method() {
		return TRUE;
	}

}

class B extends A {

	public function __construct() {
		
		var_dump(self::method());
		var_dump(parent::method());
		
		var_dump(self::$property);
		var_dump(parent::$property);
	
	}
	
}

new B;
?>


Expected result:
----------------
bool(true)
bool(true)
bool(true)
bool(true)

Actual result:
--------------
bool(true)
bool(true)
bool(true)
Fatal error: Cannot access protected property A::$property in
/www/test2.php on line 21

-- 
Edit bug report at http://bugs.php.net/?id=30451&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30451&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30451&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30451&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30451&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30451&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30451&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30451&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30451&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30451&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30451&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30451&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30451&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30451&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30451&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30451&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30451&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30451&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30451&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30451&r=mysqlcfg


Thread (7 messages)

« previous php.bugs (#67638) next »