/hphp/test/zend/bad/ext/pcre/tests/preg_match_all_error.php
PHP | 23 lines | 16 code | 0 blank | 7 comment | 0 complexity | 59e03bdf063656940c764df3846d2b16 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
- */
- echo "*** Testing preg_match_all() : error conditions ***\n";
- // Zero arguments
- echo "\n-- Testing preg_match_all() function with Zero arguments --\n";
- var_dump(preg_match_all());
- //Test preg_match_all with one more than the expected number of arguments
- echo "\n-- Testing preg_match_all() function with more than expected no. of arguments --\n";
- $pattern = '/\w/';
- $subject = 'string_val';
- $flags = PREG_OFFSET_CAPTURE;
- $offset = 10;
- $extra_arg = 10;
- var_dump(preg_match_all($pattern, $subject, $matches, $flags, $offset, $extra_arg));
- // Testing preg_match_all withone less than the expected number of arguments
- echo "\n-- Testing preg_match_all() function with less than expected no. of arguments --\n";
- $pattern = '/\w/';
- var_dump(preg_match_all($pattern));
- echo "Done"
- ?>