summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-05-29 21:48:56 +0000
committerFelipe Pena <felipe@php.net>2010-05-29 21:48:56 +0000
commit3c4ff06ca796aed254e30ccc3dfadc4a972f7d19 (patch)
tree4145281fbe7ec7ac1e319852c3b5e233dc9d60f6
parent97b7620aed0020c38d1bee90884ed5c830302b48 (diff)
downloadphp-git-3c4ff06ca796aed254e30ccc3dfadc4a972f7d19.tar.gz
- Fixed wrong abstract class identification (it was identified as a Trait)
-rw-r--r--ext/reflection/php_reflection.c2
-rw-r--r--ext/reflection/tests/traits002.phpt54
2 files changed, 55 insertions, 1 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index b04e749182..9b85b79d81 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -367,7 +367,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
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);
diff --git a/ext/reflection/tests/traits002.phpt b/ext/reflection/tests/traits002.phpt
new file mode 100644
index 0000000000..fc0dd59b2e
--- /dev/null
+++ b/ext/reflection/tests/traits002.phpt
@@ -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] {
+ }
+}