diff options
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | ext/pcre/php_pcre.c | 2 | ||||
| -rw-r--r-- | ext/pcre/tests/bug42737.phpt | 19 |
3 files changed, 21 insertions, 1 deletions
@@ -43,6 +43,7 @@ PHP NEWS class). (Dmitry) - Fixed bug #42798 (__autoload() not triggered for classes used in method signature). (Dmitry) +- Fixed bug #42737 (preg_split('//u') triggers a E_NOTICE with newlines). (Nuno) - Fixed bug #42657 (ini_get() returns incorrect value when default is NULL). (Jani) - Fixed bug #42069 (parse_ini_file() allows using some non-alpha numeric diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 1984a97277..ec36ac4763 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1528,7 +1528,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec if (re_bump == NULL) { int dummy; - if ((re_bump = pcre_get_compiled_regex("/./u", &extra_bump, &dummy TSRMLS_CC)) == NULL) { + if ((re_bump = pcre_get_compiled_regex("/./us", &extra_bump, &dummy TSRMLS_CC)) == NULL) { RETURN_FALSE; } } diff --git a/ext/pcre/tests/bug42737.phpt b/ext/pcre/tests/bug42737.phpt new file mode 100644 index 0000000000..8d9dd52b31 --- /dev/null +++ b/ext/pcre/tests/bug42737.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #42737 (preg_split('//u') triggers a E_NOTICE with newlines) +--FILE-- +<?php + +$string = chr(13).chr(10); + +$array = preg_split('//u', $string, - 1, PREG_SPLIT_NO_EMPTY); + +var_dump(array_map('ord', $array)); + +?> +--EXPECT-- +array(2) { + [0]=> + int(13) + [1]=> + int(10) +} |
