felipe                                   Sat, 29 May 2010 21:48:56 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299940

Log:
- Fixed wrong abstract class identification (it was identified as a Trait)

Changed paths:
    U   php/php-src/trunk/ext/reflection/php_reflection.c
    A   php/php-src/trunk/ext/reflection/tests/traits002.phpt

Modified: php/php-src/trunk/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/trunk/ext/reflection/php_reflection.c   2010-05-29 21:28:24 UTC 
(rev 299939)
+++ php/php-src/trunk/ext/reflection/php_reflection.c   2010-05-29 21:48:56 UTC 
(rev 299940)
@@ -367,7 +367,7 @@
                char *kind = "Class";
                if (ce->ce_flags & ZEND_ACC_INTERFACE) {
                        kind = "Interface";
-               } else if (ce->ce_flags & ZEND_ACC_TRAIT) {
+               } else if ((ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
                        kind = "Trait";
                }
                string_printf(str, "%s%s [ ", indent, kind);

Added: php/php-src/trunk/ext/reflection/tests/traits002.phpt
===================================================================
--- php/php-src/trunk/ext/reflection/tests/traits002.phpt                       
        (rev 0)
+++ php/php-src/trunk/ext/reflection/tests/traits002.phpt       2010-05-29 
21:48:56 UTC (rev 299940)
@@ -0,0 +1,54 @@
+--TEST--
+ReflectionClass and Traits
+--FILE--
+<?php
+
+abstract class foo {
+}
+
+trait bar {
+
+}
+
+reflectionclass::export('foo');
+reflectionclass::export('bar');
+
+?>
+--EXPECTF--
+Class [ <user> trait foo ] {
+  @@ %s 3-4
+
+  - Constants [0] {
+  }
+
+  - Static properties [0] {
+  }
+
+  - Static methods [0] {
+  }
+
+  - Properties [0] {
+  }
+
+  - Methods [0] {
+  }
+}
+
+Trait [ <user> trait bar ] {
+  @@ %s 6-8
+
+  - Constants [0] {
+  }
+
+  - Static properties [0] {
+  }
+
+  - Static methods [0] {
+  }
+
+  - Properties [0] {
+  }
+
+  - Methods [0] {
+  }
+}


Property changes on: php/php-src/trunk/ext/reflection/tests/traits002.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

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

Reply via email to