PageRenderTime 39ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 26 lines | 19 code | 0 blank | 7 comment | 0 complexity | 4d71eb33c5c74cd30d9efe025d69951b 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. error_reporting(E_ALL&~E_NOTICE);
  7. /*
  8. * Testing how preg_match_all reacts to being passed the wrong type of regex argument
  9. */
  10. echo "*** Testing preg_match_all() : error conditions ***\n";
  11. $regex_array = array('abcdef', //Regex without delimiter
  12. '/[a-zA-Z]', //Regex without closing delimiter
  13. '[a-zA-Z]/', //Regex without opening delimiter
  14. '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
  15. '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
  16. );
  17. $subject = 'test';
  18. foreach($regex_array as $regex_value) {
  19. print "\nArg value is $regex_value\n";
  20. var_dump(preg_match_all($regex_value, $subject, $matches1));
  21. var_dump($matches1);
  22. }
  23. $regex_value = new stdclass(); //Object
  24. var_dump(preg_match_all($regex_value, $subject, $matches));
  25. var_dump($matches);
  26. ?>