Commit:    c8f47a8e7c36bf57188b6172ffc0fbc6028f3050
Author:    Dmitry Stogov <dmi...@zend.com>         Mon, 21 May 2012 13:46:07 
+0400
Parents:   c5fcd9f5af09b69df998a4226f66f2ea320f46db
Branches:  PHP-5.4

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=c8f47a8e7c36bf57188b6172ffc0fbc6028f3050

Log:
Fixed bug #61998 (Using traits with method aliases appears to result in crash 
during execution)

Bugs:
https://bugs.php.net/61998

Changed paths:
  A  Zend/tests/traits/bug61998.phpt


Diff:
diff --git a/Zend/tests/traits/bug61998.phpt b/Zend/tests/traits/bug61998.phpt
new file mode 100644
index 0000000..612caa0
--- /dev/null
+++ b/Zend/tests/traits/bug61998.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Bug #61998 (Using traits with method aliases appears to result in crash during 
execution)
+--FILE--
+<?php
+class Foo {
+    use T1 {
+       func as newFunc;
+    }
+
+    public function func() {
+        echo "From Foo\n";
+    }
+}
+
+trait T1 { 
+    public function func() {
+        echo "From T1\n";
+    }
+}
+
+class Bar {
+    public function func() {
+        echo "From Bar\n";
+    }
+    public function func2() {
+        echo "From Bar\n";
+    }
+    public function func3() {
+        echo "From Bar\n";
+    }
+    use T1 {
+        func as newFunc;
+        func as func2;
+    }
+    use T2 {
+        func2 as newFunc2;
+        func2 as newFunc3;
+        func2 as func3;
+    }
+}
+
+trait T2 { 
+    public function func2() {
+        echo "From T2\n";
+    }
+}
+
+$f = new Foo();
+
+$f->newFunc(); //from T1
+$f->func(); //from Foo
+
+$b = new Bar();
+$b->newFunc(); //from T1
+$b->func(); //from Bar
+$b->func2(); //from Bar
+$b->newFunc2(); //from T2
+$b->newFunc3(); //from T2
+$b->func3(); //from Bar
+--EXPECTF--
+From T1
+>From Foo
+From T1
+From Bar
+From Bar
+From T2
+From T2
+From Bar


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to