1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 09:12:14 +01:00
Files
archived-php-src/ext/standard/tests/strings/join_error.phpt
Nikita Popov 0ba34824f5 Use TypeError instead of warning in implode()
These are again manual argument type checks.
2019-05-31 11:04:13 +02:00

31 lines
697 B
PHP

--TEST--
Test join() function: error conditions
--FILE--
<?php
/* Prototype : string join( string $glue, array $pieces )
* Description: Join array elements with a string
* Source code: ext/standard/string.c
* Alias of function: implode()
*/
echo "*** Testing join() : error conditions ***\n";
// Less than expected number of arguments
echo "\n-- Testing join() with less than expected no. of arguments --\n";
$glue = 'string_val';
try {
var_dump(join($glue));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECT--
*** Testing join() : error conditions ***
-- Testing join() with less than expected no. of arguments --
Argument must be an array
Done