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