mirror of
https://github.com/php/php-src.git
synced 2024-09-24 11:27:28 +00:00
Merge branch 'PHP-5.5'
* PHP-5.5: Fixed bug #62343 (Show class_alias In get_declared_classes())
This commit is contained in:
commit
baa5b3ef74
13
Zend/tests/bug62343.phpt
Normal file
13
Zend/tests/bug62343.phpt
Normal file
@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #62343 (Show class_alias In get_declared_classes())
|
||||
--FILE--
|
||||
<?php
|
||||
class a { }
|
||||
class_alias("a", "b");
|
||||
$c = get_declared_classes();
|
||||
var_dump(end($c));
|
||||
var_dump(prev($c));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "b"
|
||||
string(1) "a"
|
@ -1625,6 +1625,13 @@ ZEND_FUNCTION(restore_exception_handler)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int same_name(const char *key, const char *name, zend_uint name_len)
|
||||
{
|
||||
char *lcname = zend_str_tolower_dup(name, name_len);
|
||||
int ret = memcmp(lcname, key, name_len) == 0;
|
||||
efree(lcname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int copy_class_or_interface_name(zend_class_entry **pce TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
|
||||
{
|
||||
@ -1636,7 +1643,13 @@ static int copy_class_or_interface_name(zend_class_entry **pce TSRMLS_DC, int nu
|
||||
|
||||
if ((hash_key->nKeyLength==0 || hash_key->arKey[0]!=0)
|
||||
&& (comply_mask == (ce->ce_flags & mask))) {
|
||||
add_next_index_stringl(array, ce->name, ce->name_length, 1);
|
||||
if (ce->refcount > 1 &&
|
||||
(ce->name_length != hash_key->nKeyLength - 1 ||
|
||||
!same_name(hash_key->arKey, ce->name, ce->name_length))) {
|
||||
add_next_index_stringl(array, hash_key->arKey, hash_key->nKeyLength - 1, 1);
|
||||
} else {
|
||||
add_next_index_stringl(array, ce->name, ce->name_length, 1);
|
||||
}
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user