bug70685.phpt 565 B

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