[PHP-CVS] svn: /php/php-src/trunk/ext/reflection/ php_reflection.c tests/traits002.phpt

2010-05-29 Thread Felipe Pena
felipe   Sat, 29 May 2010 21:48:56 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=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

[PHP-CVS] svn: /php/php-src/trunk/ext/reflection/ php_reflection.c tests/traits002.phpt

2010-05-29 Thread Felipe Pena
felipe   Sat, 29 May 2010 21:55:19 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299941

Log:
- Missing Trait check fix

Changed paths:
U   php/php-src/trunk/ext/reflection/php_reflection.c
U   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:48:56 UTC 
(rev 299940)
+++ php/php-src/trunk/ext/reflection/php_reflection.c   2010-05-29 21:55:19 UTC 
(rev 299941)
@@ -382,7 +382,7 @@
}
if (ce-ce_flags  ZEND_ACC_INTERFACE) {
string_printf(str, interface );
-   } else if (ce-ce_flags  ZEND_ACC_TRAIT) {
+   } else if ((ce-ce_flags  ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
string_printf(str, trait );
} else {
if (ce-ce_flags  
(ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {

Modified: php/php-src/trunk/ext/reflection/tests/traits002.phpt
===
--- php/php-src/trunk/ext/reflection/tests/traits002.phpt   2010-05-29 
21:48:56 UTC (rev 299940)
+++ php/php-src/trunk/ext/reflection/tests/traits002.phpt   2010-05-29 
21:55:19 UTC (rev 299941)
@@ -15,7 +15,7 @@

 ?
 --EXPECTF--
-Class [ user trait foo ] {
+Class [ user abstract class foo ] {
   @@ %s 3-4

   - Constants [0] {

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