From: Felipe Pena Date: Thu, 7 Jul 2011 23:07:14 +0000 (+0000) Subject: - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though... X-Git-Tag: php-5.4.0alpha2~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=09842e83ba5349f1a8095e525c20c427abc59c2a;p=php - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none) --- diff --git a/Zend/tests/bug55156.phpt b/Zend/tests/bug55156.phpt new file mode 100644 index 0000000000..6c0ff768d1 --- /dev/null +++ b/Zend/tests/bug55156.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none) +--FILE-- +getDocComment()); + + /** test1 */ + class bar { } + + /** test2 */ + class foo extends namespace\bar { } + + $x = new \ReflectionClass('foo\bar'); + var_dump($x->getDocComment()); + + $x = new \ReflectionClass('foo\foo'); + var_dump($x->getDocComment()); +} + +?> +--EXPECTF-- +bool(false) +string(12) "/** test1 */" +string(12) "/** test2 */" diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f3b6b77718..15906fc4c3 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6487,6 +6487,12 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC efree(CG(current_import)); CG(current_import) = NULL; } + + if (CG(doc_comment)) { + efree(CG(doc_comment)); + CG(doc_comment) = NULL; + CG(doc_comment_len) = 0; + } } /* }}} */