Open
Description
Description
The following code:
<?php
$dateInterval = new DateInterval('PT1S'); // or even DateInterval::createFromDateString('1 second')
var_dump(isset($dateInterval->from_string));
(array) $dateInterval; // or print_r() or var_dump()
var_dump(isset($dateInterval->from_string));
Resulted in this output:
bool(false)
bool(true)
But I expected this output instead:
bool(true)
bool(true)
According documentation property $from_string
should be always defined (in PHP >= 8.2) but it isn't. Dump of the object initializes the property "ad hoc". var_dump()
shouldn't have side effects IMHO.
PHP Version
PHP 8.2.20
Operating System
No response