xref: /PHP-7.3/ext/pcre/tests/bug21732.phpt (revision 0344311b)
1--TEST--
2Bug #21732 (preg_replace() segfaults with invalid parameters)
3--INI--
4error_reporting=0
5--FILE--
6<?php
7class foo {
8	function cb($param) {
9		var_dump($param);
10		return "yes!";
11	}
12}
13
14var_dump(preg_replace('', array(), ''));
15var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde'));
16?>
17--EXPECT--
18bool(false)
19array(4) {
20  [0]=>
21  string(5) "abcde"
22  [1]=>
23  string(2) "ab"
24  [2]=>
25  string(2) "cd"
26  [3]=>
27  string(1) "e"
28}
29string(4) "yes!"
30