Bug #70292 [Opn->Dup]: Calling array_key_exists/var_dump on \DateTime adds public fields

From: Date: Tue, 18 Aug 2015 11:47:59 +0000
Subject: Bug #70292 [Opn->Dup]: Calling array_key_exists/var_dump on \DateTime adds public fields
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195282@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70292&edit=1 ID: 70292 Updated by: cmb@php.net Reported by: orminapod3 at gmail dot com Summary: Calling array_key_exists/var_dump on \DateTime adds public fields -Status: Open +Status: Duplicate Type: Bug Package: *General Issues Operating System: Any PHP Version: 7.0.0beta3 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Basically, that is a duplicate of bug #69587. Previous Comments: ------------------------------------------------------------------------ [2015-08-18 11:21:54] orminapod3 at gmail dot com Description: ------------ Upon calling var_dump() or array_key_exists() on a \DateTime object, it will receive new public properties not accessible before. Test script: --------------- $object = new DateTime(); array_key_exists("test",$object); var_dump($object->date); Expected result: ---------------- The result should be the same regardless of the arbitrary calls ( probably fields should not exist at all ) Actual result: -------------- For the code using array_key_exists/var_dump, we receive a string from the public field. Otherwise we receive a warning. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70292&edit=1

« previous php.bugs (#195282) next »