]> granicus.if.org Git - php/commitdiff
- Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though...
authorFelipe Pena <felipe@php.net>
Thu, 7 Jul 2011 23:07:14 +0000 (23:07 +0000)
committerFelipe Pena <felipe@php.net>
Thu, 7 Jul 2011 23:07:14 +0000 (23:07 +0000)
Zend/tests/bug55156.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/Zend/tests/bug55156.phpt b/Zend/tests/bug55156.phpt
new file mode 100644 (file)
index 0000000..6c0ff76
--- /dev/null
@@ -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 */"
index f3b6b77718cdace41a76288d088cdb4c88b50e91..15906fc4c34a9dc53b2a246dc793047e9f003dcd 100644 (file)
@@ -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;
+       }
 }
 /* }}} */