1--TEST--
2Test substr_replace() function : error conditions
3--FILE--
4<?php
5/*
6 * Testing substr_replace() for error conditions
7*/
8
9echo "*** Testing substr_replace() : error conditions ***\n";
10
11$s1 = "Good morning";
12
13echo "\n-- Testing substr_replace() function with start and length as arrays but string not--\n";
14try {
15    var_dump(substr_replace($s1, "evening", array(5)));
16} catch (TypeError $e) {
17    echo $e->getMessage(), "\n";
18}
19try {
20    var_dump(substr_replace($s1, "evening", 5, array(1)));
21} catch (TypeError $e) {
22    echo $e->getMessage(), "\n";
23}
24
25?>
26--EXPECT--
27*** Testing substr_replace() : error conditions ***
28
29-- Testing substr_replace() function with start and length as arrays but string not--
30substr_replace(): Argument #3 ($offset) cannot be an array when working on a single string
31substr_replace(): Argument #4 ($length) cannot be an array when working on a single string
32