1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/Zend/tests/__debugInfo_reference.phpt
Niels Dossche 4f0554fa54 Properly handle __debugInfo() returning an array reference
Currently, this fails because the type is IS_REFERENCE instead of
IS_ARRAY, but this could be confusing because a function return value is
normally dereferenced automatically in a lot of cases.

Closes GH-18762.
2025-06-09 11:44:21 +02:00

23 lines
265 B
PHP

--TEST--
__debugInfo with reference return
--FILE--
<?php
class Test {
private $tmp = ['x' => 1];
public function &__debugInfo(): array
{
return $this->tmp;
}
}
var_dump(new Test);
?>
--EXPECT--
object(Test)#1 (1) {
["x"]=>
int(1)
}