Skip to content

Commit 0d6c56a

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fixed #75220 - Segfault when calling is_callable on parent
2 parents 33b4405 + 2dd7745 commit 0d6c56a

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.2.0RC4
44

5+
- Core
6+
. Fixed bug #75220 (Segfault when calling is_callable on parent).
7+
(andrewnester)
58

69
28 Sep 2017, PHP 7.2.0RC3
710

Zend/zend_API.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,8 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
31293129
(!fcc->function_handler->common.scope ||
31303130
!instanceof_function(ce_org, fcc->function_handler->common.scope))) {
31313131
if (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
3132-
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
3132+
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
3133+
fcc->function_handler->common.function_name) {
31333134
zend_string_release(fcc->function_handler->common.function_name);
31343135
}
31353136
zend_free_trampoline(fcc->function_handler);
@@ -3355,7 +3356,8 @@ static zend_bool zend_is_callable_impl(zval *callable, zend_object *object, uint
33553356
((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
33563357
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
33573358
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
3358-
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
3359+
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
3360+
fcc->function_handler->common.function_name) {
33593361
zend_string_release(fcc->function_handler->common.function_name);
33603362
}
33613363
zend_free_trampoline(fcc->function_handler);
@@ -3413,7 +3415,8 @@ static zend_bool zend_is_callable_impl(zval *callable, zend_object *object, uint
34133415
((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
34143416
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
34153417
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
3416-
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
3418+
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
3419+
fcc->function_handler->common.function_name) {
34173420
zend_string_release(fcc->function_handler->common.function_name);
34183421
}
34193422
zend_free_trampoline(fcc->function_handler);

ext/standard/tests/bug75220.phpt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
Bug #75220 (is_callable crash for 'parent')
3+
--FILE--
4+
<?php
5+
6+
$a = new A();
7+
$a->bar('foo');
8+
9+
class B {};
10+
class A extends B
11+
{
12+
function bar($func)
13+
{
14+
var_dump('foo');
15+
var_dump(is_callable('parent::foo'));
16+
var_dump(is_callable(array('parent', 'foo')));
17+
}
18+
19+
function __call($func, $args)
20+
{
21+
}
22+
};
23+
24+
?>
25+
--EXPECT--
26+
string(3) "foo"
27+
bool(false)
28+
bool(false)

0 commit comments

Comments
 (0)