php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74852 DateInterval: property_exists returns true from unknown DateInterval property
Submitted: 2017-07-04 06:43 UTC Modified: 2017-07-06 11:20 UTC
From: pjunk at gmx dot de Assigned: jhdxr
Status: Closed Package: Date/time related
PHP Version: 7.0.14 OS: LINUX
Private report: No CVE-ID:
 [2017-07-04 06:43 UTC] pjunk at gmx dot de
Description:
------------
property_exists from any unknown DateInterval property have a incorrect result
and throw a notice.

Test script:
---------------
$interval = new DateInterval('P2D');
var_dump(property_exists($interval,'abcde'));

Expected result:
----------------
bool(false)

Actual result:
--------------
Notice:  Undefined property: DateInterval::$abcde in ... on line 3
bool(true)

Workaround
----------
//use get_class()
$interval = new DateInterval('P2D');
var_dump(property_exists(get_class($interval),'abcde'));

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-04 07:12 UTC] pjunk at gmx dot de
-Package: *General Issues +Package: Date/time related
 [2017-07-04 07:12 UTC] pjunk at gmx dot de
Edit package
 [2017-07-04 11:17 UTC] anon at example dot com
Note: <https://3v4l.org/PIcbM> shows that this bug was introduced in PHP 7.0.14, probably by the same change that fixed bug #69587 (see <https://3v4l.org/HjqF6>).
 [2017-07-06 11:20 UTC] jhdxr@php.net
-Status: Open +Status: Assigned -PHP Version: 7.1.6 +PHP Version: 7.0.14 -Assigned To: +Assigned To: jhdxr
 [2017-07-10 05:54 UTC] krakjoe@php.net
Automatic comment on behalf of jhdxr
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5cf54f6073f9e3cfc99eca9e8a5706a08dd404a1
Log: Fixed bug #74852 (property_exists returns true on unknown DateInterval property)
 [2017-07-10 05:54 UTC] krakjoe@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sat Aug 19 14:01:35 2017 UTC