mb_strripos_error2.phpt 979 B

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