Skip to content

Commit 078f674

Browse files
committed
Merge branch 'PHP-5.6' into PHP-7.0
2 parents db1ef5c + e4a006c commit 078f674

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ PHP NEWS
1919
- IMAP:
2020
. Fixed bug #72852 (imap_mail null dereference). (Anatol)
2121

22+
- Intl:
23+
. Fixed bug #65732 (grapheme_*() is not Unicode compliant on CR LF
24+
sequence). (cmb)
25+
2226
- OCI8
2327
. Fixed invalid handle error with Implicit Result Sets. (Chris Jones)
2428
. Fixed bug #72524 (Binding null values triggers ORA-24816 error). (Chris Jones)

ext/intl/grapheme/grapheme_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ zend_long grapheme_ascii_check(const unsigned char *day, size_t len)
223223
{
224224
int ret_len = len;
225225
while ( len-- ) {
226-
if ( *day++ > 0x7f )
226+
if ( *day++ > 0x7f || (*day == '\n' && *(day - 1) == '\r') )
227227
return -1;
228228
}
229229

ext/intl/tests/bug65732.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #65732 (grapheme_*() is not Unicode compliant on CR LF sequence)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('intl')) die('skip intl extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
var_dump(grapheme_strlen("\r\n"));
10+
var_dump(grapheme_substr(implode("\r\n", ['abc', 'def', 'ghi']), 5));
11+
var_dump(grapheme_strrpos("a\r\nb", 'b'));
12+
?>
13+
==DONE==
14+
--EXPECT--
15+
int(1)
16+
string(7) "ef
17+
ghi"
18+
int(2)
19+
==DONE==

0 commit comments

Comments
 (0)