summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2011-07-07 23:07:14 +0000
committerFelipe Pena <felipe@php.net>2011-07-07 23:07:14 +0000
commit09842e83ba5349f1a8095e525c20c427abc59c2a (patch)
treeb94bcdd4c9b946fb79eda6a20bfb9fd1c3356807
parent5ddd67d90b70bd9f2f8445dafd0656909ccf06ed (diff)
downloadphp-git-09842e83ba5349f1a8095e525c20c427abc59c2a.tar.gz
- Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none)
-rw-r--r--Zend/tests/bug55156.phpt30
-rw-r--r--Zend/zend_compile.c6
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;
+ }
}
/* }}} */