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 | 09842e83ba5349f1a8095e525c20c427abc59c2a (patch) | |
tree | b94bcdd4c9b946fb79eda6a20bfb9fd1c3356807 /Zend | |
parent | 5ddd67d90b70bd9f2f8445dafd0656909ccf06ed (diff) | |
download | php-git-09842e83ba5349f1a8095e525c20c427abc59c2a.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; + } } /* }}} */ |