mb_strstr_error2.phpt 948 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Test mb_strstr() function : error conditions
  3. --SKIPIF--
  4. <?php
  5. extension_loaded('mbstring') or die('skip');
  6. function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
  7. ?>
  8. --FILE--
  9. <?php
  10. /* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
  11. * Description: Finds first occurrence of a string within another
  12. * Source code: ext/mbstring/mbstring.c
  13. * Alias to functions:
  14. */
  15. echo "*** Testing mb_strstr() : error conditions ***\n";
  16. echo "\n-- Testing mb_strstr() with unknown encoding --\n";
  17. $haystack = 'Hello, world';
  18. $needle = 'world';
  19. $encoding = 'unknown-encoding';
  20. $part = true;
  21. var_dump( mb_strstr($haystack, $needle, $part, $encoding) );
  22. ?>
  23. ===DONE===
  24. --EXPECTF--
  25. *** Testing mb_strstr() : error conditions ***
  26. -- Testing mb_strstr() with unknown encoding --
  27. Warning: mb_strstr(): Unknown encoding "unknown-encoding" in %s on line %d
  28. bool(false)
  29. ===DONE===