/hphp/test/zend/bad/ext/pcre/tests/preg_match_all_error2.php
PHP | 22 lines | 15 code | 0 blank | 7 comment | 0 complexity | 84a353d5de49166e9518fd322ed17e38 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?php
- /*
- * proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
- * Function is implemented in ext/pcre/php_pcre.c
- */
- error_reporting(E_ALL&~E_NOTICE);
- /*
- * Testing how preg_match_all reacts to being passed the wrong type of input argument
- */
- echo "*** Testing preg_match_all() : error conditions ***\n";
- $regex = '/[a-zA-Z]/';
- $value = new stdclass(); //Object
- var_dump(preg_match_all($regex, $value, $matches));
- var_dump($matches);
- $input = array(array('this is', 'a subarray'), 'test',);
- foreach($input as $value) {
- print "\nArg value is: $value\n";
- var_dump(preg_match_all($regex, $value, $matches));
- var_dump($matches);
- }
- echo "Done";
- ?>