Bug #70437 [NEW]: Changes to static properties in trait methods are not reflected in the class
| From: | davey@php.net | Date: | Sun, 06 Sep 2015 14:32:50 +0000 |
| Subject: | Bug #70437 [NEW]: Changes to static properties in trait methods are not reflected in the class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195802@lists.php.net to get a copy of this message | ||
From: davey
Operating system: OSX/Linux
PHP version: 7.0.0RC2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Changes to static properties in trait methods are not reflected in the class
Description:
------------
If you have a trait that defines a static property, and you modify said
property from within a trait inherited method, the modifications are
done to a trait instance of the property, as opposed to the
inherited-from-trait static property within the class.
The behavior differs slightly in PHP 5.4.7 - 5.5.29 in that if the
methods are instance methods, then they will correctly modify the
inherited-from-trait static property, but are broken for static methods.
5.6.0+ has the same behavior for static and instance methods.
Test script:
---------------
Static methods: https://3v4l.org/UZ6gq
Instance methods: https://3v4l.org/piUFm
Expected result:
----------------
Should modify the inherited-from-trait static property within the class
Actual result:
--------------
Modifies a trait-specific copy of the static property
--
Edit bug report at https://bugs.php.net/bug.php?id=70437&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70437&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70437&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70437&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70437&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70437&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70437&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70437&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70437&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70437&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70437&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70437&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70437&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70437&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70437&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70437&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70437&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70437&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70437&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70437&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70437&r=mysqlcfg