1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00
Files
archived-php-src/ext/standard/tests/strings/trim_error.phpt
Fabien Villepinte a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00

42 lines
1.1 KiB
PHP

--TEST--
Test trim() function : error conditions
--FILE--
<?php
/* Prototype : string trim ( string $str [, string $charlist ] )
* Description: Strip whitespace (or other characters) from the beginning and end of a string.
* Source code: ext/standard/string.c
*/
echo "*** Testing trim() : error conditions ***\n";
$hello = " Hello World\n";
echo "\n-- Test trim function with various invalid charlists --\n";
var_dump(trim($hello, "..a"));
var_dump(trim($hello, "a.."));
var_dump(trim($hello, "z..a"));
var_dump(trim($hello, "a..b..c"));
?>
--EXPECTF--
*** Testing trim() : error conditions ***
-- Test trim function with various invalid charlists --
Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
string(14) " Hello World
"
Warning: trim(): Invalid '..'-range, no character to the right of '..' in %s on line %d
string(14) " Hello World
"
Warning: trim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d
string(14) " Hello World
"
Warning: trim(): Invalid '..'-range in %s on line %d
string(14) " Hello World
"