Bug #69587 [NEW]: SPL objects (DateInterval) and isset
| From: | charlesw at ex-situ dot com | Date: | Wed, 06 May 2015 19:22:23 +0000 |
| Subject: | Bug #69587 [NEW]: SPL objects (DateInterval) and isset | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-192532@lists.php.net to get a copy of this message | ||
From: charlesw at ex-situ dot com
Operating system: CentOS / OSX / Other
PHP version: 5.6.8
Package: SPL related
Bug Type: Bug
Bug description:SPL objects (DateInterval) and isset
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)
--
Edit bug report at https://bugs.php.net/bug.php?id=69587&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69587&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69587&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69587&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69587&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69587&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69587&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69587&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69587&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69587&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69587&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69587&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69587&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69587&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69587&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69587&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69587&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69587&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69587&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69587&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69587&r=mysqlcfg