diff options
author | Felipe Pena <felipe@php.net> | 2011-07-07 23:07:14 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2011-07-07 23:07:14 +0000 |
commit | 866240200f41560593e2e8958e713f3aa3a03a6c (patch) | |
tree | 0f67c0c3d41541b09181c587d31ba29cde183704 /Zend | |
parent | 50b654ab0e28ae65436bcfeae224b54138dcbb39 (diff) | |
download | php-git-866240200f41560593e2e8958e713f3aa3a03a6c.tar.gz |
- Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/tests/bug55156.phpt | 30 | ||||
-rw-r--r-- | Zend/zend_compile.c | 6 |
2 files changed, 36 insertions, 0 deletions
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-- +<?php + +/** test */ +namespace foo { + function test() { } + + $x = new \ReflectionFunction('foo\test'); + var_dump($x->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; + } } /* }}} */ |