Skip to content

Instantly share code, notes, and snippets.

@hughdavenport
Created December 29, 2018 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hughdavenport/5128662f237d8b54d2e2b22dc7d18d5e to your computer and use it in GitHub Desktop.
Save hughdavenport/5128662f237d8b54d2e2b22dc7d18d5e to your computer and use it in GitHub Desktop.
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 68922b6966..bc34f19e30 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -1296,8 +1296,8 @@ PHP_FUNCTION(mb_split)
}
/* otherwise we just have one last element to add to the array */
- n = ((OnigUChar *)(string + string_len) - chunk_pos);
- if (n > 0) {
+ if ((OnigUChar *)(string + string_len) > chunk_pos) {
+ n = ((OnigUChar *)(string + string_len) - chunk_pos);
add_next_index_stringl(return_value, (char *)chunk_pos, n);
} else {
add_next_index_stringl(return_value, "", 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment