Bug #74852 [Opn]: DateInterval: property_exists returns true from unknown DateInterval property

From: Date: Tue, 04 Jul 2017 07:12:09 +0000
Subject: Bug #74852 [Opn]: DateInterval: property_exists returns true from unknown DateInterval property
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209798@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 User updated by: pjunk at gmx dot de Reported by: pjunk at gmx dot de Summary: DateInterval: property_exists returns true from unknown DateInterval property Status: Open Type: Bug -Package: *General Issues +Package: Date/time related Operating System: LINUX PHP Version: 7.1.6 Block user comment: N Private report: N New Comment: Edit package Previous Comments: ------------------------------------------------------------------------ [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 (#209798) next »