1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 21:41:22 +02:00
Files
archived-php-src/ext/intl/tests/bug65732.phpt
Christoph M. Becker e4a006cd3e Fix #65732: grapheme_*() is not Unicode compliant on CR LF sequence
According to the Unicode specification (at least as of 5.1), CRLF sequences
are considered to be a single grapheme. We cater to that special case by
letting grapheme_ascii_check() fail. While it would be trivial to fix
grapheme_ascii_check() wrt. grapheme_strlen(), grapheme_substr() and
grapheme_strrpos() would be much harder to handle, so we accept the slight
performance penalty if CRLF is involved.
2016-08-20 03:01:35 +02:00

20 lines
399 B
PHP

--TEST--
Bug #65732 (grapheme_*() is not Unicode compliant on CR LF sequence)
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not available');
?>
--FILE--
<?php
var_dump(grapheme_strlen("\r\n"));
var_dump(grapheme_substr(implode("\r\n", ['abc', 'def', 'ghi']), 5));
var_dump(grapheme_strrpos("a\r\nb", 'b'));
?>
==DONE==
--EXPECT--
int(1)
string(7) "ef
ghi"
int(2)
==DONE==