Skip to content

Commit 7469953

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fixed bug #78747
2 parents 813305b + 5249993 commit 7469953

File tree

4 files changed

+42
-14
lines changed

4 files changed

+42
-14
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ PHP NEWS
2020
- OpCache:
2121
. Fixed bug #78654 (Incorrectly computed opcache checksum on files with
2222
non-ascii characters). (mhagstrand)
23+
. Fixed bug #78747 (OpCache corrupts custom extension result). (Nikita)
2324

2425
- Reflection:
2526
. Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,8 +1694,7 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa
16941694
zval *zv;
16951695
func_info_t *info;
16961696

1697-
zv = zend_hash_find_ex(&func_info, Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array, call_info->caller_init_opline, call_info->caller_init_opline->op2, ssa->rt_constants)), 1);
1698-
if (zv) {
1697+
if (!call_info->callee_func->common.scope && (zv = zend_hash_find_ex(&func_info, Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array, call_info->caller_init_opline, call_info->caller_init_opline->op2, ssa->rt_constants)), 1))) {
16991698
info = Z_PTR_P(zv);
17001699
if (UNEXPECTED(zend_optimizer_is_disabled_func(info->name, info->name_len))) {
17011700
ret = MAY_BE_NULL;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Internal static methods should not be confused with global functions
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('zend-test')) die('skip requires zend-test');
6+
?>
7+
--FILE--
8+
<?php
9+
10+
var_dump(is_bool(_ZendTestClass::is_object()));
11+
12+
?>
13+
--EXPECT--
14+
bool(false)

ext/zend_test/test.c

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,20 @@ static zend_function *zend_test_class_method_get(zend_object **object, zend_stri
158158
/* }}} */
159159

160160
static zend_function *zend_test_class_static_method_get(zend_class_entry *ce, zend_string *name) /* {{{ */ {
161-
zend_internal_function *fptr = emalloc(sizeof(zend_internal_function));
162-
fptr->type = ZEND_OVERLOADED_FUNCTION;
163-
fptr->num_args = 1;
164-
fptr->arg_info = NULL;
165-
fptr->scope = ce;
166-
fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_STATIC;
167-
fptr->function_name = name;
168-
fptr->handler = ZEND_FN(zend_test_func);
169-
zend_set_function_arg_flags((zend_function*)fptr);
170-
171-
return (zend_function*)fptr;
161+
if (zend_string_equals_literal_ci(name, "test")) {
162+
zend_internal_function *fptr = emalloc(sizeof(zend_internal_function));
163+
fptr->type = ZEND_OVERLOADED_FUNCTION;
164+
fptr->num_args = 1;
165+
fptr->arg_info = NULL;
166+
fptr->scope = ce;
167+
fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_STATIC;
168+
fptr->function_name = name;
169+
fptr->handler = ZEND_FN(zend_test_func);
170+
zend_set_function_arg_flags((zend_function*)fptr);
171+
172+
return (zend_function*)fptr;
173+
}
174+
return zend_std_get_static_method(ce, name, NULL);
172175
}
173176
/* }}} */
174177

@@ -178,11 +181,22 @@ static int zend_test_class_call_method(zend_string *method, zend_object *object,
178181
}
179182
/* }}} */
180183

184+
/* Internal function returns bool, we return int. */
185+
static ZEND_METHOD(_ZendTestClass, is_object) /* {{{ */ {
186+
RETURN_LONG(42);
187+
}
188+
/* }}} */
189+
181190
static ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ {
182191
RETURN_TRUE;
183192
}
184193
/* }}} */
185194

195+
static const zend_function_entry zend_test_class_methods[] = {
196+
ZEND_ME(_ZendTestClass, is_object, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
197+
ZEND_FE_END
198+
};
199+
186200
static const zend_function_entry zend_test_trait_methods[] = {
187201
ZEND_ME(_ZendTestTrait, testMethod, NULL, ZEND_ACC_PUBLIC)
188202
ZEND_FE_END
@@ -195,7 +209,7 @@ PHP_MINIT_FUNCTION(zend_test)
195209
INIT_CLASS_ENTRY(class_entry, "_ZendTestInterface", NULL);
196210
zend_test_interface = zend_register_internal_interface(&class_entry);
197211
zend_declare_class_constant_long(zend_test_interface, ZEND_STRL("DUMMY"), 0);
198-
INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", NULL);
212+
INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", zend_test_class_methods);
199213
zend_test_class = zend_register_internal_class_ex(&class_entry, NULL);
200214
zend_class_implements(zend_test_class, 1, zend_test_interface);
201215
zend_test_class->create_object = zend_test_class_new;

0 commit comments

Comments
 (0)