Bug #74852 [Asn->Csd]: DateInterval: property_exists returns true from unknown DateInterval property

From: Date: Mon, 10 Jul 2017 05:54:43 +0000
Subject: Bug #74852 [Asn->Csd]: DateInterval: property_exists returns true from unknown DateInterval property
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209950@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 Updated by: krakjoe@php.net Reported by: pjunk at gmx dot de Summary: DateInterval: property_exists returns true from unknown DateInterval property -Status: Assigned +Status: Closed Type: Bug Package: Date/time related Operating System: LINUX PHP Version: 7.0.14 Assigned To: jhdxr Block user comment: N Private report: N New Comment: 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) Previous Comments: ------------------------------------------------------------------------ [2017-07-04 12:09:06] pjunk at gmx dot de http://sandbox.onlinephpfunctions.com/code/71cede612a9596e3da533894e34622211a8a57f4 ------------------------------------------------------------------------ [2017-07-04 11:17:36] 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-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

« previous php.bugs (#209950) next »