xref: /PHP-8.2/Zend/tests/bug70124.phpt (revision 36935e42)
1--TEST--
2Bug #70124 (null ptr deref / seg fault in ZEND_HANDLE_EXCEPTION_SPEC_HANDLER)
3--FILE--
4<?php
5
6try  {
7    echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$f("test"))],chr(48));
8} catch (Error $e) {
9    var_dump($e->getMessage());
10}
11
12class A {
13}
14
15try  {
16    echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),a::y("test"))],chr(48));
17} catch (Error $e) {
18    var_dump($e->getMessage());
19}
20
21$a = new A;
22
23try  {
24    echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$a->y("test"))],chr(48));
25} catch (Error $e) {
26    var_dump($e->getMessage());
27}
28
29try  {
30    echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),\bar\y("test"))],chr(48));
31} catch (Error $e) {
32    var_dump($e->getMessage());
33}
34
35try  {
36    echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),y("test"))],chr(48));
37} catch (Error $e) {
38    var_dump($e->getMessage());
39}
40?>
41--EXPECTF--
42Warning: Undefined variable $f in %s on line %d
43string(34) "Value of type null is not callable"
44string(31) "Call to undefined method A::y()"
45string(31) "Call to undefined method A::y()"
46string(34) "Call to undefined function bar\y()"
47string(30) "Call to undefined function y()"
48