|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-06-13 13:10 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2016-06-13 13:10 UTC] cmb@php.net
[2018-09-29 12:30 UTC] nikic@php.net
-Status: Verified
+Status: Duplicate
[2018-09-29 12:30 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
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)