Bug #69925 [NEW]: ReflectionProperty::setAccessible() permanently mutates properties on DateTime

From: Date: Thu, 25 Jun 2015 02:30:25 +0000
Subject: Bug #69925 [NEW]: ReflectionProperty::setAccessible() permanently mutates properties on DateTime
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193859@lists.php.net to get a copy of this message
From: mark at mark-story dot com Operating system: MacOS 10.10.3 PHP version: 5.5.26 Package: Reflection related Bug Type: Bug Bug description:ReflectionProperty::setAccessible() permanently mutates properties on DateTime Description: ------------ The documentation for ReflectionProperty::setAccessible() implies that the change should not effect the object property visibility and this is true of user land classes, however DateTime works a bit differently, and doesn't match the behavior around userland classes. Test script: --------------- <?php $subject = new DateTime('2015-06-24 22:09:00'); var_dump(isset($subject->timezone)); $reflection = new ReflectionObject($subject); foreach ($reflection->getProperties() as $prop) { $prop->setAccessible(true); $prop->setAccessible(false); } var_dump(isset($subject->timezone)); Expected result: ---------------- I would expect the output to be: bool(false) bool(false) Actual result: -------------- However, it is: bool(false) bool(true) -- Edit bug report at https://bugs.php.net/bug.php?id=69925&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69925&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69925&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69925&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69925&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69925&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69925&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69925&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69925&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69925&r=support Expected behavior: https://bugs.php.net/fix.php?id=69925&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69925&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69925&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69925&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69925&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69925&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69925&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69925&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69925&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69925&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69925&r=mysqlcfg

« previous php.bugs (#193859) next »