#35393 [Asn->Csd]: changing static protected members from outside the class

From: Date: Mon, 28 Nov 2005 14:35:28 +0000
Subject: #35393 [Asn->Csd]: changing static protected members from outside the class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89241@lists.php.net to get a copy of this message
ID: 35393 Updated by: dmitry@php.net Reported By: tony2001@php.net -Status: Assigned +Status: Closed Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.1.0 Assigned To: dmitry New Comment: Fixed in CVS HEAD and PHP_5_1. Previous Comments: ------------------------------------------------------------------------ [2005-11-25 14:49:04] tony2001@php.net Assigned to Dmitry by his request. ------------------------------------------------------------------------ [2005-11-25 14:46:39] tony2001@php.net Description: ------------ It's possible to change value of static protected member with a tricky code like the one below (pay attention to the "()" around the method call). Reproduce code: --------------- class ObjectPath { static protected $type = array(0=>'main'); static function getType() { return self::$type; } } var_dump(ObjectPath::getType()); $object_type = array_pop((ObjectPath::getType())); var_dump(ObjectPath::getType()); Expected result: ---------------- array(1) { [0]=> string(4) "main" } array(1) { [0]=> string(4) "main" } Actual result: -------------- array(1) { [0]=> string(4) "main" } array(0) { } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35393&edit=1

« previous php.bugs (#89241) next »