Bug #74852 [Com]: DateInterval: property_exists returns true from unknown DateInterval property
| From: | anon at example dot com | Date: | Tue, 04 Jul 2017 11:17:38 +0000 |
| Subject: | Bug #74852 [Com]: DateInterval: property_exists returns true from unknown DateInterval property | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209800@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74852&edit=1
ID: 74852
Comment by: anon at example dot com
Reported by: pjunk at gmx dot de
Summary: DateInterval: property_exists returns true from
unknown DateInterval property
Status: Open
Type: Bug
Package: Date/time related
Operating System: LINUX
PHP Version: 7.1.6
Block user comment: N
Private report: N
New Comment:
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>).
Previous Comments:
------------------------------------------------------------------------
[2017-07-04 07:12:09] pjunk at gmx dot de
Edit package
------------------------------------------------------------------------
[2017-07-04 06:43:41] 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'));
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74852&edit=1