PageRenderTime 38ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/pcre/tests/preg_match_all_error.php

http://github.com/facebook/hiphop-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
  1. <?php
  2. /*
  3. * proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
  4. * Function is implemented in ext/pcre/php_pcre.c
  5. */
  6. echo "*** Testing preg_match_all() : error conditions ***\n";
  7. // Zero arguments
  8. echo "\n-- Testing preg_match_all() function with Zero arguments --\n";
  9. var_dump(preg_match_all());
  10. //Test preg_match_all with one more than the expected number of arguments
  11. echo "\n-- Testing preg_match_all() function with more than expected no. of arguments --\n";
  12. $pattern = '/\w/';
  13. $subject = 'string_val';
  14. $flags = PREG_OFFSET_CAPTURE;
  15. $offset = 10;
  16. $extra_arg = 10;
  17. var_dump(preg_match_all($pattern, $subject, $matches, $flags, $offset, $extra_arg));
  18. // Testing preg_match_all withone less than the expected number of arguments
  19. echo "\n-- Testing preg_match_all() function with less than expected no. of arguments --\n";
  20. $pattern = '/\w/';
  21. var_dump(preg_match_all($pattern));
  22. echo "Done"
  23. ?>