1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 23:48:14 +02:00
Files
archived-php-src/ext/standard/tests/strings/rtrim_error.phpt
T
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 rtrim() function : error conditions
--FILE--
<?php
/* Prototype : string rtrim ( string $str [, string $charlist ] )
* Description: Strip whitespace (or other characters) from the end of a string.
* Source code: ext/standard/string.c
*/
echo "*** Testing rtrim() : error conditions ***\n";
$hello = " Hello World\n";
echo "\n-- Test rtrim function with various invalid charlists\n";
var_dump(rtrim($hello, "..a"));
var_dump(rtrim($hello, "a.."));
var_dump(rtrim($hello, "z..a"));
var_dump(rtrim($hello, "a..b..c"));
?>
--EXPECTF--
*** Testing rtrim() : error conditions ***
-- Test rtrim function with various invalid charlists
Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
string(14) " Hello World
"
Warning: rtrim(): Invalid '..'-range, no character to the right of '..' in %s on line %d
string(14) " Hello World
"
Warning: rtrim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d
string(14) " Hello World
"
Warning: rtrim(): Invalid '..'-range in %s on line %d
string(14) " Hello World
"