diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2016-08-20 03:09:10 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2016-08-20 03:11:05 +0200 |
commit | 29849e5ba12b186b9af0839fc80342682fdc5d51 (patch) | |
tree | f48d1da6e6117c783150d0bca75603db55fafbb9 /ext | |
parent | 76c796fb2706f7cfd7fa2d4a2f69957d0d8318b0 (diff) | |
parent | 078f6742127c65cfbeeac4b5aa3290263367822c (diff) | |
download | php-git-29849e5ba12b186b9af0839fc80342682fdc5d51.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
Diffstat (limited to 'ext')
-rw-r--r-- | ext/intl/grapheme/grapheme_util.c | 2 | ||||
-rw-r--r-- | ext/intl/tests/bug65732.phpt | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c index 042092ea59..d81060b5a1 100644 --- a/ext/intl/grapheme/grapheme_util.c +++ b/ext/intl/grapheme/grapheme_util.c @@ -223,7 +223,7 @@ zend_long grapheme_ascii_check(const unsigned char *day, size_t len) { int ret_len = len; while ( len-- ) { - if ( *day++ > 0x7f ) + if ( *day++ > 0x7f || (*day == '\n' && *(day - 1) == '\r') ) return -1; } diff --git a/ext/intl/tests/bug65732.phpt b/ext/intl/tests/bug65732.phpt new file mode 100644 index 0000000000..b49f884ee4 --- /dev/null +++ b/ext/intl/tests/bug65732.phpt @@ -0,0 +1,19 @@ +--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== |