summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2016-08-20 03:02:43 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2016-08-20 03:04:08 +0200
commit078f6742127c65cfbeeac4b5aa3290263367822c (patch)
tree47793892b65a4b1abed03d668683fde337fe01da
parentdb1ef5cb00e6bcdd166179fe1293eb628054107b (diff)
parente4a006cd3e17338677ec269a8cdb1354f38e0cad (diff)
downloadphp-git-078f6742127c65cfbeeac4b5aa3290263367822c.tar.gz
Merge branch 'PHP-5.6' into PHP-7.0
-rw-r--r--NEWS4
-rw-r--r--ext/intl/grapheme/grapheme_util.c2
-rw-r--r--ext/intl/tests/bug65732.phpt19
3 files changed, 24 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 6e6edcf1e9..2726658215 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,10 @@ PHP NEWS
- IMAP:
. Fixed bug #72852 (imap_mail null dereference). (Anatol)
+- Intl:
+ . Fixed bug #65732 (grapheme_*() is not Unicode compliant on CR LF
+ sequence). (cmb)
+
- OCI8
. Fixed invalid handle error with Implicit Result Sets. (Chris Jones)
. Fixed bug #72524 (Binding null values triggers ORA-24816 error). (Chris Jones)
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c
index b590631c72..020d0d6ef9 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==