mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
- Fixed bug #54624 (class_alias and type hint)
This commit is contained in:
parent
c9e41e8901
commit
5670174b66
26
Zend/tests/bug54624.phpt
Normal file
26
Zend/tests/bug54624.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #54624 (class_alias and type hint)
|
||||
--FILE--
|
||||
<?php
|
||||
class A
|
||||
{
|
||||
function foo(A $param) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class_alias('A', 'AliasA');
|
||||
|
||||
eval('
|
||||
class B extends A
|
||||
{
|
||||
function foo(AliasA $param) {
|
||||
}
|
||||
|
||||
}
|
||||
');
|
||||
|
||||
echo "DONE\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
DONE
|
@ -2918,11 +2918,23 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
|
||||
&& strcasecmp(fe->common.arg_info[i].class_name, proto->common.arg_info[i].class_name)!=0) {
|
||||
char *colon;
|
||||
|
||||
if (fe->common.type != ZEND_USER_FUNCTION ||
|
||||
strchr(proto->common.arg_info[i].class_name, '\\') != NULL ||
|
||||
if (fe->common.type != ZEND_USER_FUNCTION) {
|
||||
return 0;
|
||||
} else if (strchr(proto->common.arg_info[i].class_name, '\\') != NULL ||
|
||||
(colon = zend_memrchr(fe->common.arg_info[i].class_name, '\\', fe->common.arg_info[i].class_name_len)) == NULL ||
|
||||
strcasecmp(colon+1, proto->common.arg_info[i].class_name) != 0) {
|
||||
return 0;
|
||||
zend_class_entry **fe_ce, **proto_ce;
|
||||
TSRMLS_FETCH();
|
||||
int found = zend_lookup_class(fe->common.arg_info[i].class_name, fe->common.arg_info[i].class_name_len, &fe_ce TSRMLS_CC);
|
||||
int found2 = zend_lookup_class(proto->common.arg_info[i].class_name, proto->common.arg_info[i].class_name_len, &proto_ce TSRMLS_CC);
|
||||
|
||||
/* Check for class alias */
|
||||
if (found != SUCCESS || found2 != SUCCESS ||
|
||||
(*fe_ce)->type == ZEND_INTERNAL_CLASS ||
|
||||
(*proto_ce)->type == ZEND_INTERNAL_CLASS ||
|
||||
*fe_ce != *proto_ce) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fe->common.arg_info[i].type_hint != proto->common.arg_info[i].type_hint) {
|
||||
|
Loading…
Reference in New Issue
Block a user