xref: /PHP-8.2/Zend/tests/bug70895.phpt (revision 99d0f502)
1--TEST--
2Bug #70895 null ptr deref and segfault with crafted callable
3--FILE--
4<?php
5
6try {
7    array_map("%n", 0);
8} catch (TypeError $e) {
9    echo $e->getMessage(), "\n";
10}
11try {
12    array_map("%n %i", 0);
13} catch (TypeError $e) {
14    echo $e->getMessage(), "\n";
15}
16try {
17    array_map("%n %i aoeu %f aoeu %p", 0);
18} catch (TypeError $e) {
19    echo $e->getMessage(), "\n";
20}
21?>
22--EXPECT--
23array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n" not found or invalid function name
24array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i" not found or invalid function name
25array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i aoeu %f aoeu %p" not found or invalid function name
26