[php-src] Issue #11310: __debugInfo() does nothing on classes extending DateTime
| From: | terrafrost | Date: | Wed, 24 May 2023 14:14:56 +0000 |
| Subject: | [php-src] Issue #11310: __debugInfo() does nothing on classes extending DateTime | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244517@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11310
Author: terrafrost
### Description
The following code:
```php
<?php
class Demo extends DateTime
{
public function __debugInfo(): array
{
return ['value' => 'zzz'];
}
}
$d = new Demo();
var_dump($d);
```
Resulted in this output:
```
object(Demo)#1 (3) {
["date"]=>
string(26) "2023-05-24 15:59:35.014710"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
```
But I expected this output instead:
```
object(Demo)#1 (1) {
["value"]=>
string(3) "zzz"
}
```
### PHP Version
PHP 8.2.6
### Operating System
Windows 11