--- /dev/null
+--TEST--
+Bug #62892 (ReflectionClass::getTraitAliases crashes on importing trait methods as private)
+--FILE--
+<?php
+
+trait myTrait {
+ public function run() {}
+}
+
+class myClass {
+ use myTrait {
+ MyTrait::run as private;
+ }
+}
+$class = new \ReflectionClass('myClass');
+var_dump($class->getTraitAliases());
+
+?>
+--EXPECTF--
+array(0) {
+}
int method_name_len;
zend_trait_method_reference *cur_ref = ce->trait_aliases[i]->trait_method;
- method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name);
- add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0);
+ if (ce->trait_aliases[i]->alias) {
+ method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name);
+ add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0);
+ }
i++;
}
}