Bug #73683 [Nab]: DateInterval can no longer be accessed as array
| From: | sjon at hortensius dot net | Date: | Thu, 08 Dec 2016 12:55:41 +0000 |
| Subject: | Bug #73683 [Nab]: DateInterval can no longer be accessed as array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205840@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73683&edit=1
ID: 73683
User updated by: sjon at hortensius dot net
Reported by: sjon at hortensius dot net
Summary: DateInterval can no longer be accessed as array
Status: Not a bug
Type: Bug
Package: Date/time related
PHP Version: 7.1.0
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Maybe my test-script was too verbose; but are you saying array-access was broken intentionally? Why
does this no longer work?
$dp = new DateInterval('P2Y3W3D');
var_dump(isset($dp->d));
Previous Comments:
------------------------------------------------------------------------
[2016-12-08 12:51:28] cmb@php.net
Indeed, the behavioral change has been introduced with commit 23f9e482[1] which *fixed* <https://bugs.php.net/69587>. However, the fact that the
behavior has changed is not a bug, because isset($dp->d) should always have yielded TRUE, so the
supplied test script relies on broken behavior.
[1] <http://git.php.net/?p=php-src.git;a=commit;h=23f9e482732b99f381e37afa77e04c2c480f372d>
------------------------------------------------------------------------
[2016-12-08 10:44:26] sjon at hortensius dot net
Description:
------------
I found another issue that was broken between RC6 and the final 7.1.0 release; this is probably
broken by the fix for bug #69587
Test script:
---------------
$dp = new DateInterval('P2Y3W3D');
var_dump(isset($dp->d, $dp['d']));
echo $dp->d;
Expected result:
----------------
bool(true)
3
Actual result:
--------------
Fatal error: Uncaught Error: Cannot use object of type DateInterval as array in /in/XQOQD:4 Stack
trace: #0 {main} thrown in /in/XQOQD on line 4
Process exited with code 255.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73683&edit=1