From 866240200f41560593e2e8958e713f3aa3a03a6c Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 7 Jul 2011 23:07:14 +0000 Subject: [PATCH] - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none) --- Zend/tests/bug55156.phpt | 30 ++++++++++++++++++++++++++++++ Zend/zend_compile.c | 6 ++++++ 2 files changed, 36 insertions(+) create mode 100644 Zend/tests/bug55156.phpt 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; + } } /* }}} */ -- 2.40.0