felipe                                   Sat, 29 May 2010 22:08:51 +0000

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

Log:
- Fixed ReflectionClass::isTrait() checking (to not identify abstract class as 
Trait)

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

Modified: php/php-src/trunk/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/trunk/ext/reflection/php_reflection.c   2010-05-29 22:00:43 UTC 
(rev 299942)
+++ php/php-src/trunk/ext/reflection/php_reflection.c   2010-05-29 22:08:51 UTC 
(rev 299943)
@@ -3999,7 +3999,7 @@
    Returns whether this is a trait */
 ZEND_METHOD(reflection_class, isTrait)
 {
-       _class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_TRAIT);
+       _class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_TRAIT & 
~ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
 }
 /* }}} */


Added: php/php-src/trunk/ext/reflection/tests/traits003.phpt
===================================================================
--- php/php-src/trunk/ext/reflection/tests/traits003.phpt                       
        (rev 0)
+++ php/php-src/trunk/ext/reflection/tests/traits003.phpt       2010-05-29 
22:08:51 UTC (rev 299943)
@@ -0,0 +1,30 @@
+--TEST--
+Reflection and Traits
+--FILE--
+<?php
+
+abstract class foo {
+}
+
+trait bar {
+
+}
+
+final class baz {
+
+}
+
+$x = new ReflectionClass('foo');
+var_dump($x->isTrait());
+
+$x = new ReflectionClass('bar');
+var_dump($x->isTrait());
+
+$x = new ReflectionClass('baz');
+var_dump($x->isTrait());
+
+?>
+--EXPECT--
+bool(false)
+bool(true)
+bool(false)


Property changes on: php/php-src/trunk/ext/reflection/tests/traits003.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