felipe                                   Thu, 07 Jul 2011 23:07:14 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313056

Log:
- Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even 
though the class has none)

Bug: https://bugs.php.net/55156 (Closed) ReflectionClass::getDocComment() 
returns comment even though the class has none
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    A   php/php-src/branches/PHP_5_3/Zend/tests/bug55156.phpt
    A   php/php-src/branches/PHP_5_4/Zend/tests/bug55156.phpt
    U   php/php-src/branches/PHP_5_4/Zend/zend_compile.c
    A   php/php-src/trunk/Zend/tests/bug55156.phpt
    U   php/php-src/trunk/Zend/zend_compile.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-07-07 15:21:17 UTC (rev 313055)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-07-07 23:07:14 UTC (rev 313056)
@@ -1,6 +1,10 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2011, PHP 5.3.7
+- Zend Engine:
+  . Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even
+    though the class has none). (Felipe)
+
 - Core
   . Fixed bug #53727 (Inconsistent behavior of is_subclass_of with interfaces)
     (Ralph Schindler, Dmitry)

Added: php/php-src/branches/PHP_5_3/Zend/tests/bug55156.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug55156.phpt                       
        (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug55156.phpt       2011-07-07 
23:07:14 UTC (rev 313056)
@@ -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 */"

Added: php/php-src/branches/PHP_5_4/Zend/tests/bug55156.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/tests/bug55156.phpt                       
        (rev 0)
+++ php/php-src/branches/PHP_5_4/Zend/tests/bug55156.phpt       2011-07-07 
23:07:14 UTC (rev 313056)
@@ -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 */"

Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_compile.c    2011-07-07 15:21:17 UTC 
(rev 313055)
+++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c    2011-07-07 23:07:14 UTC 
(rev 313056)
@@ -6487,6 +6487,12 @@
                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;
+       }
 }
 /* }}} */


Added: php/php-src/trunk/Zend/tests/bug55156.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug55156.phpt                          (rev 0)
+++ php/php-src/trunk/Zend/tests/bug55156.phpt  2011-07-07 23:07:14 UTC (rev 
313056)
@@ -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 */"

Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c       2011-07-07 15:21:17 UTC (rev 
313055)
+++ php/php-src/trunk/Zend/zend_compile.c       2011-07-07 23:07:14 UTC (rev 
313056)
@@ -6487,6 +6487,12 @@
                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;
+       }
 }
 /* }}} */


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to