1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 18:22:42 +01:00

Merge branch 'PHP-7.1'

This commit is contained in:
Nikita Popov
2017-02-03 17:55:08 +01:00
2 changed files with 14 additions and 2 deletions

View File

@@ -5276,10 +5276,10 @@ PHP_FUNCTION(substr_count)
if (ac == 4) {
if (length <= 0) {
if (length < 0) {
length += (haystack_len - offset);
}
if ((length <= 0) || ((size_t)length > (haystack_len - offset))) {
if (length < 0 || ((size_t)length > (haystack_len - offset))) {
php_error_docref(NULL, E_WARNING, "Invalid length value");
RETURN_FALSE;
}

View File

@@ -0,0 +1,12 @@
--TEST--
Bug #74041: substr_count with length=0 broken
--FILE--
<?php
var_dump(substr_count("aaa", "a", 0, 0));
var_dump(substr_count("", "a", 0, 0));
?>
--EXPECT--
int(0)
int(0)