Skip to content

Commit 4cb53a0

Browse files
committed
Add garbage collection test
1 parent 89363fa commit 4cb53a0

File tree

1 file changed

+26
-0
lines changed
  • Zend/tests/new_obj_access_without_parentheses

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Object instantiated without parentheses is collected
3+
--FILE--
4+
<?php
5+
6+
class A
7+
{
8+
public function test(): void
9+
{
10+
echo 'called' . PHP_EOL;
11+
}
12+
13+
public function __destruct()
14+
{
15+
echo 'collected' . PHP_EOL;
16+
}
17+
}
18+
19+
new A()->test();
20+
echo 'code after' . PHP_EOL;
21+
22+
?>
23+
--EXPECT--
24+
called
25+
collected
26+
code after

0 commit comments

Comments
 (0)