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

This commit is contained in:
Felipe Pena 2010-05-29 22:08:51 +00:00
parent 27c2c35953
commit 2d63683ec3
2 changed files with 31 additions and 1 deletions

View File

@ -3999,7 +3999,7 @@ ZEND_METHOD(reflection_class, isInterface)
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);
}
/* }}} */

View File

@ -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)