xref: /PHP-8.3/Zend/tests/bug70685.phpt (revision 78773890)
1--TEST--
2Bug #70685: Segfault for getClosure() internal method rebind with invalid $this
3--FILE--
4<?php
5
6class cls {}
7
8$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
9$c = $c->bindTo(new cls);
10var_dump($c);
11
12$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
13$c = $c->bindTo(new SplStack, 'cls');
14var_dump($c);
15
16?>
17--EXPECTF--
18Warning: Cannot bind method SplDoublyLinkedList::count() to object of class cls in %s on line %d
19NULL
20
21Warning: Cannot rebind scope of closure created from method in %s on line %d
22NULL
23