mirror of
https://github.com/php/php-src.git
synced 2026-04-14 11:32:11 +02:00
Merge branch 'PHP-7.3'
This commit is contained in:
18
Zend/tests/bug76901.phpt
Normal file
18
Zend/tests/bug76901.phpt
Normal file
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #76901: method_exists on SPL iterator passthrough method corrupts memory
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$it = new ArrayIterator([1, 2, 3]);
|
||||
$it = new IteratorIterator($it);
|
||||
foreach ($it as $v) {
|
||||
if (method_exists($it, 'offsetGet')) {
|
||||
var_dump($it->offsetGet(0));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
@@ -1343,13 +1343,10 @@ ZEND_FUNCTION(method_exists)
|
||||
if (zend_hash_exists(&ce->function_table, lcname)) {
|
||||
zend_string_release_ex(lcname, 0);
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
zend_function *func = NULL;
|
||||
|
||||
if (Z_TYPE_P(klass) == IS_OBJECT
|
||||
&& Z_OBJ_HT_P(klass)->get_method != NULL
|
||||
&& (func = Z_OBJ_HT_P(klass)->get_method(&Z_OBJ_P(klass), method_name, NULL)) != NULL
|
||||
) {
|
||||
} else if (Z_TYPE_P(klass) == IS_OBJECT && Z_OBJ_HT_P(klass)->get_method != NULL) {
|
||||
zend_object *obj = Z_OBJ_P(klass);
|
||||
zend_function *func = Z_OBJ_HT_P(klass)->get_method(&obj, method_name, NULL);
|
||||
if (func != NULL) {
|
||||
if (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
|
||||
/* Returns true to the fake Closure's __invoke */
|
||||
RETVAL_BOOL(func->common.scope == zend_ce_closure
|
||||
|
||||
Reference in New Issue
Block a user