mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Merge branch 'fix-strripos-memleak' of https://github.com/reeze/php-src
This commit is contained in:
commit
4369215b8f
@ -2114,6 +2114,7 @@ PHP_FUNCTION(strripos)
|
||||
needle = Z_STR_P(zneedle);
|
||||
} else {
|
||||
if (php_needle_char(zneedle, ord_needle->val) != SUCCESS) {
|
||||
STR_ALLOCA_FREE(ord_needle, use_heap);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ord_needle->val[1] = '\0';
|
||||
@ -2121,6 +2122,7 @@ PHP_FUNCTION(strripos)
|
||||
}
|
||||
|
||||
if ((haystack->len == 0) || (needle->len == 0)) {
|
||||
STR_ALLOCA_FREE(ord_needle, use_heap);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,9 @@ strripos() function
|
||||
var_dump(@strripos("a", ""));
|
||||
var_dump(@strripos("", "a"));
|
||||
var_dump(@strripos("\\\\a", "\\a"));
|
||||
|
||||
$fp = fopen(__FILE__, "r");
|
||||
var_dump(@strripos("", $fp));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(5)
|
||||
@ -30,4 +33,5 @@ bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
int(1)
|
||||
bool(false)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user