1--TEST-- 2Test preg_match_all() function : error conditions - wrong arg types 3--FILE-- 4<?php 5/* 6* Function is implemented in ext/pcre/php_pcre.c 7*/ 8/* 9* Testing how preg_match_all reacts to being passed the wrong type of input argument 10*/ 11echo "*** Testing preg_match_all() : error conditions ***\n"; 12$regex = '/[a-zA-Z]/'; 13$input = array(array('this is', 'a subarray'), 'test',); 14foreach($input as $value) { 15 @print "\nArg value is: $value\n"; 16 try { 17 var_dump(preg_match_all($regex, $value, $matches)); 18 } catch (TypeError $e) { 19 echo $e->getMessage(), "\n"; 20 } 21 var_dump($matches); 22} 23echo "Done"; 24?> 25--EXPECT-- 26*** Testing preg_match_all() : error conditions *** 27 28Arg value is: Array 29preg_match_all(): Argument #2 ($subject) must be of type string, array given 30NULL 31 32Arg value is: test 33int(4) 34array(1) { 35 [0]=> 36 array(4) { 37 [0]=> 38 string(1) "t" 39 [1]=> 40 string(1) "e" 41 [2]=> 42 string(1) "s" 43 [3]=> 44 string(1) "t" 45 } 46} 47Done 48