mb_strripos_error1.phpt [plain text]
--TEST--
Test mb_strripos() function : error conditions - Pass incorrect number of args
--SKIPIF--
<?php
extension_loaded('mbstring') or die('skip');
function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
?>
--FILE--
<?php
echo "*** Testing mb_strripos() : error conditions ***\n";
echo "\n-- Testing mb_strripos() function with more than expected no. of arguments --\n";
$haystack = b'string_val';
$needle = b'string_val';
$offset = 10;
$encoding = 'string_val';
$extra_arg = 10;
var_dump( mb_strripos($haystack, $needle, $offset, $encoding, $extra_arg) );
echo "\n-- Testing mb_strripos() function with less than expected no. of arguments --\n";
$haystack = b'string_val';
var_dump( mb_strripos($haystack) );
echo "Done";
?>
--EXPECTF--
*** Testing mb_strripos() : error conditions ***
-- Testing mb_strripos() function with more than expected no. of arguments --
Warning: mb_strripos() expects at most 4 parameters, 5 given in %s on line %d
NULL
-- Testing mb_strripos() function with less than expected no. of arguments --
Warning: mb_strripos() expects at least 2 parameters, 1 given in %s on line %d
NULL
Done