xref: /PHP-7.4/ext/intl/tests/bug62759.phpt (revision 860a5c4b)
1--TEST--
2Bug #62759: Buggy grapheme_substr() on edge case
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7var_dump(substr('deja', 1, -4));
8var_dump(substr('deja', -1, 0));
9var_dump(grapheme_substr('deja', 1, -4));
10var_dump(intl_get_error_message());
11var_dump(grapheme_substr('deja', -1, 0));
12var_dump(grapheme_substr('déjà', 1, -4));
13var_dump(intl_get_error_message());
14var_dump(grapheme_substr('déjà', -1, 0));
15?>
16--EXPECT--
17bool(false)
18string(0) ""
19bool(false)
20string(61) "grapheme_substr: invalid parameters: U_ILLEGAL_ARGUMENT_ERROR"
21string(0) ""
22bool(false)
23string(65) "grapheme_substr: length is beyond start: U_ILLEGAL_ARGUMENT_ERROR"
24string(0) ""
25