[php-src] Issue #21605: Missing addref for Countable::count()
[email protected] (iluuu1994)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/21605
Author: iluuu1994
### Description
### Description
The following code:
```php
<?php
class C implements Countable {
public function count(): int {
global $c;
$c = null;
var_dump($this);
return 42;
}
}
$c = new C;
var_dump(count($c));
```
Resulted in this output:
```
Segfault
```
But I expected this output instead:
```
```
Originally reported by @cnwangjihe.
### PHP Version
```plain
PHP 8.2+
```
### Operating System
_No response_