#42681 [Opn->Asn]: Static variables in sub/superclasses

From: Date: Tue, 18 Sep 2007 10:44:17 +0000
Subject: #42681 [Opn->Asn]: Static variables in sub/superclasses
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117634@lists.php.net to get a copy of this message
ID: 42681 Updated by: jani@php.net Reported By: alex94040 at yahoo dot com -Status: Open +Status: Assigned Bug Type: Class/Object related -Operating System: Windows +Operating System: * PHP Version: 5.2.4 -Assigned To: +Assigned To: helly New Comment: Marcus, can you reply to this please? Previous Comments: ------------------------------------------------------------------------ [2007-09-16 03:36:20] alex94040 at yahoo dot com Description: ------------ This is a reactivation of bug 28442; that bug shows as "fixed/closed", but the issue still repros. We need to be able to redefine static members of classes (including constants), and set them independently. Reproduce code: --------------- class ClassA { private static $cn; public static function setName( $cn ) { self::$cn = $cn; } public static function getName( ) { return self::$cn; } } class ClassB extends ClassA { private static $cn; // with or without this, result is the same } ClassA::setName( 'AAA' ); ClassB::setName( 'BBB' ); print( ClassA::getName() . "\n" ); // prints 'BBB' print( ClassB::getName() . "\n" ); // prints 'BBB' Expected result: ---------------- Result should read "AAA BBB" Actual result: -------------- Result actually reads "BBB BBB" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42681&edit=1

« previous php.bugs (#117634) next »