mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #78543: is_callable() on FFI\CData throws Exception
This commit is contained in:
commit
d6ef63db53
2 changed files with 19 additions and 1 deletions
|
@ -3230,12 +3230,18 @@ check_func:
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case IS_OBJECT:
|
case IS_OBJECT:
|
||||||
if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(callable), &fcc->calling_scope, &fcc->function_handler, &fcc->object) == SUCCESS) {
|
if (Z_OBJ_HANDLER_P(callable, get_closure)) {
|
||||||
|
if (Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(callable), &fcc->calling_scope, &fcc->function_handler, &fcc->object) == SUCCESS) {
|
||||||
fcc->called_scope = fcc->calling_scope;
|
fcc->called_scope = fcc->calling_scope;
|
||||||
if (fcc == &fcc_local) {
|
if (fcc == &fcc_local) {
|
||||||
zend_release_fcall_info_cache(fcc);
|
zend_release_fcall_info_cache(fcc);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
} else {
|
||||||
|
/* Discard exceptions thrown from Z_OBJ_HANDLER_P(callable, get_closure)
|
||||||
|
TODO: extend get_closure() with additional argument and prevent exception throwing in the first place */
|
||||||
|
zend_clear_exception();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (error) *error = estrdup("no array or string given");
|
if (error) *error = estrdup("no array or string given");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
12
ext/ffi/tests/bug78543.phpt
Normal file
12
ext/ffi/tests/bug78543.phpt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #78543 (is_callable() on FFI\CData throws Exception)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once('skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$ffi = FFI::cdef(' struct test { int dummy; }; ');
|
||||||
|
$test = $ffi->new('struct test');
|
||||||
|
var_dump(is_callable($test));
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
bool(false)
|
Loading…
Add table
Add a link
Reference in a new issue