preg_quote_error.phpt 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Test preg_quote() function : error conditions - wrong numbers of parameters
  3. --FILE--
  4. <?php
  5. /*
  6. * proto string preg_quote(string str [, string delim_char])
  7. * Function is implemented in ext/pcre/php_pcre.c
  8. */
  9. echo "*** Testing preg_quote() : error conditions ***\n";
  10. // Zero arguments
  11. echo "\n-- Testing preg_quote() function with Zero arguments --\n";
  12. var_dump(preg_quote());
  13. //Test preg_quote with one more than the expected number of arguments
  14. echo "\n-- Testing preg_quote() function with more than expected no. of arguments --\n";
  15. $str = 'string_val';
  16. $delim_char = '/';
  17. $extra_arg = 10;
  18. var_dump(preg_quote($str, $delim_char, $extra_arg));
  19. echo "Done"
  20. ?>
  21. --EXPECTF--
  22. *** Testing preg_quote() : error conditions ***
  23. -- Testing preg_quote() function with Zero arguments --
  24. Warning: preg_quote() expects at least 1 parameter, 0 given in %spreg_quote_error.php on line %d
  25. NULL
  26. -- Testing preg_quote() function with more than expected no. of arguments --
  27. Warning: preg_quote() expects at most 2 parameters, 3 given in %spreg_quote_error.php on line %d
  28. NULL
  29. Done