mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
30 lines
739 B
PHP
30 lines
739 B
PHP
--TEST--
|
|
Test implode() function: error conditions
|
|
--FILE--
|
|
<?php
|
|
/* only glue */
|
|
try {
|
|
var_dump(implode("glue"));
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
/* NULL as pieces */
|
|
try {
|
|
var_dump(implode("glue", NULL));
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
/* integer as glue */
|
|
try {
|
|
var_dump(implode(12, "pieces"));
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given
|
|
implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given
|
|
implode(): Argument #2 ($array) must be of type ?array, string given
|