|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2015-05-06 20:15 UTC] cmb@php.net
-Summary: SPL objects (DateInterval) and isset
+Summary: DateInterval properties and isset
-Status: Open
+Status: Verified
-Package: SPL related
+Package: Date/time related
[2015-05-06 20:15 UTC] cmb@php.net
[2015-05-24 15:32 UTC] cmb@php.net
[2016-04-20 15:50 UTC] jhdxr@php.net
-Status: Verified
+Status: Assigned
-Operating System: CentOS / OSX / Other
+Operating System: All
-PHP Version: 5.6.8
+PHP Version: 7.0.5
-Assigned To:
+Assigned To: jhdxr
[2016-11-13 05:37 UTC] krakjoe@php.net
[2016-11-13 05:37 UTC] krakjoe@php.net
-Status: Assigned
+Status: Closed
[2016-11-13 05:38 UTC] krakjoe@php.net
[2016-11-13 05:40 UTC] krakjoe@php.net
[2016-11-22 13:14 UTC] krakjoe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ Testing public properties on DateInterval objects with isset returns false even when they contain data. Running a print_r or var_dump on the object BEFORE testing isset will provide the desired result. Test script: --------------- $currentDate = new DateTime(); $targetDate = new DateTime('2015-03-05 11:11:11'); $interval = $currentDate->diff($targetDate); // var_dump($interval); // Uncomment and isset will give the expected response var_dump($interval->y); var_dump($interval->m); var_dump(isset($interval->y)); var_dump(isset($interval->m)); Expected result: ---------------- int(0) int(2) bool(true) bool(true) Actual result: -------------- int(0) int(2) bool(false) bool(false)