#35393 [NEW]: changing static protected members from outside the class
| From: | tony2001@php.net | Date: | Fri, 25 Nov 2005 13:46:40 +0000 |
| Subject: | #35393 [NEW]: changing static protected members from outside the class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-88964@lists.php.net to get a copy of this message | ||
From: tony2001@php.net
Operating system: Linux
PHP version: 5.1.0
PHP Bug Type: Scripting Engine problem
Bug description: changing static protected members from outside the class
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 bug report at http://bugs.php.net/?id=35393&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35393&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35393&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35393&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35393&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35393&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35393&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35393&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35393&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35393&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35393&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35393&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35393&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35393&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35393&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35393&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35393&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35393&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35393&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35393&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35393&r=mysqlcfg