php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70292 Calling array_key_exists/var_dump on \DateTime adds public fields
Submitted: 2015-08-18 11:21 UTC Modified: 2015-08-18 11:47 UTC
From: orminapod3 at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: *General Issues
PHP Version: 7.0.0beta3 OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: orminapod3 at gmail dot com
New email:
PHP Version: OS:

 

 [2015-08-18 11:21 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-18 11:47 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2015-08-18 11:47 UTC] cmb@php.net
Basically, that is a duplicate of bug #69587.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 12:01:28 2024 UTC