--- /dev/null
+--TEST--
+Bug #55086 (Namespace alias does not work inside trait's use block)
+--FILE--
+<?php
+namespace N1 {
+
+ trait T1 {
+ public function hello() { return 'hello from t1'; }
+ }
+
+ trait T2 {
+ public function hello() { return 'hello from t2'; }
+ }
+
+}
+namespace N2 {
+ use N1\T1;
+ use N1\T2;
+ class A {
+ use T1, T2 {
+ T1::hello insteadof T2;
+ T1::hello as foo;
+ }
+ }
+ $a = new A;
+ echo $a->hello(), PHP_EOL;
+ echo $a->foo(), PHP_EOL;
+ try {
+ } catch(namespace \Foo $e)
+ {
+ }
+}
+?>
+--EXPECT--
+hello from t1
+hello from t1
/* REM: There should not be a need for copying,
zend_do_begin_class_declaration is also just using that string */
if (class_name) {
+ ulong fetch_type = ZEND_FETCH_CLASS_GLOBAL;
+ zend_resolve_class_name(class_name, &fetch_type, 1 TSRMLS_CC);
method_ref->class_name = Z_STRVAL(class_name->u.constant);
method_ref->cname_len = Z_STRLEN(class_name->u.constant);
} else {
;
trait_reference_list:
- fully_qualified_class_name { zend_init_list(&$$.u.op.ptr, Z_STRVAL($1.u.constant) TSRMLS_CC); }
- | trait_reference_list ',' fully_qualified_class_name { zend_add_to_list(&$1.u.op.ptr, Z_STRVAL($3.u.constant) TSRMLS_CC); $$ = $1; }
+ fully_qualified_class_name { ulong fetch_type = ZEND_FETCH_CLASS_GLOBAL; zend_resolve_class_name(&$1, &fetch_type, 1 TSRMLS_CC); zend_init_list(&$$.u.op.ptr, Z_STRVAL($1.u.constant) TSRMLS_CC); }
+ | trait_reference_list ',' fully_qualified_class_name { ulong fetch_type = ZEND_FETCH_CLASS_GLOBAL; zend_resolve_class_name(&$3, &fetch_type, 1 TSRMLS_CC); zend_add_to_list(&$1.u.op.ptr, Z_STRVAL($3.u.constant) TSRMLS_CC); $$ = $1; }
;
trait_method_reference: