eregi_error_001.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Test eregi() function : error conditions - wrong number of args
  3. --FILE--
  4. <?php
  5. /* Prototype : proto int eregi(string pattern, string string [, array registers])
  6. * Description: Regular expression match
  7. * Source code: ext/standard/reg.c
  8. * Alias to functions:
  9. */
  10. /*
  11. * Test wrong number of args
  12. */
  13. echo "*** Testing eregi() : error conditions ***\n";
  14. //Test eregi with one more than the expected number of arguments
  15. echo "\n-- Testing eregi() function with more than expected no. of arguments --\n";
  16. $pattern = 'string_val';
  17. $string = 'string_val';
  18. $registers = array(1, 2);
  19. $extra_arg = 10;
  20. var_dump( eregi($pattern, $string, $registers, $extra_arg) );
  21. // Testing eregi with one less than the expected number of arguments
  22. echo "\n-- Testing eregi() function with less than expected no. of arguments --\n";
  23. $pattern = 'string_val';
  24. var_dump( eregi($pattern) );
  25. echo "Done";
  26. ?>
  27. --EXPECTF--
  28. *** Testing eregi() : error conditions ***
  29. -- Testing eregi() function with more than expected no. of arguments --
  30. Deprecated: Function eregi() is deprecated in %s on line %d
  31. Warning: eregi() expects at most 3 parameters, 4 given in %s on line %d
  32. NULL
  33. -- Testing eregi() function with less than expected no. of arguments --
  34. Deprecated: Function eregi() is deprecated in %s on line %d
  35. Warning: eregi() expects at least 2 parameters, 1 given in %s on line %d
  36. NULL
  37. Done