felipe                                   Sat, 14 Nov 2009 19:17:22 +0000

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

Log:
- Fixed bug #50174 (Incorrectly matched docComment)

Bug: http://bugs.php.net/50174 (Open) Incorrectly matched docComment
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    A   php/php-src/branches/PHP_5_2/Zend/tests/bug50174.phpt
    U   php/php-src/branches/PHP_5_2/Zend/zend_compile.c
    U   php/php-src/branches/PHP_5_3/NEWS
    A   php/php-src/branches/PHP_5_3/Zend/tests/bug50174.phpt
    U   php/php-src/branches/PHP_5_3/Zend/zend_compile.c
    A   php/php-src/trunk/Zend/tests/bug50174.phpt
    U   php/php-src/trunk/Zend/zend_compile.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2009-11-14 19:06:01 UTC (rev 290751)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-11-14 19:17:22 UTC (rev 290752)
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Nov 2009, PHP 5.2.12RC2
+- Fixed bug #50174 (Incorrectly matched docComment). (Felipe)

 12 Nov 2009, PHP 5.2.12RC1
 - Updated timezone database to version 2009.18 (2009r). (Derick)

Added: php/php-src/branches/PHP_5_2/Zend/tests/bug50174.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/tests/bug50174.phpt                       
        (rev 0)
+++ php/php-src/branches/PHP_5_2/Zend/tests/bug50174.phpt       2009-11-14 
19:17:22 UTC (rev 290752)
@@ -0,0 +1,31 @@
+--TEST--
+Bug #50174 (Incorrectly matched docComment)
+--FILE--
+<?php
+
+class TestClass
+{
+       /** const comment */
+       const C = 0;
+
+       function x() {}
+}
+
+$rm = new ReflectionMethod('TestClass', 'x');
+var_dump($rm->getDocComment());
+
+class TestClass2
+{
+       /** const comment */
+       const C = 0;
+
+       public $x;
+}
+
+$rp = new ReflectionProperty('TestClass2', 'x');
+var_dump($rp->getDocComment());
+
+?>
+--EXPECT--
+bool(false)
+bool(false)


Property changes on: php/php-src/branches/PHP_5_2/Zend/tests/bug50174.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_2/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/zend_compile.c    2009-11-14 19:06:01 UTC 
(rev 290751)
+++ php/php-src/branches/PHP_5_2/Zend/zend_compile.c    2009-11-14 19:17:22 UTC 
(rev 290752)
@@ -3103,6 +3103,12 @@
                zend_error(E_COMPILE_ERROR, "Cannot redefine class constant 
%s::%s", CG(active_class_entry)->name, var_name->u.constant.value.str.val);
        }
        FREE_PNODE(var_name);
+
+       if (CG(doc_comment)) {
+               efree(CG(doc_comment));
+               CG(doc_comment) = NULL;
+               CG(doc_comment_len) = 0;
+       }
 }



Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-11-14 19:06:01 UTC (rev 290751)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-11-14 19:17:22 UTC (rev 290752)
@@ -20,6 +20,7 @@
 - Fixed memory leak in extension loading when an error occurs on Windows.
   (Pierre)

+- Fixed bug #50174 (Incorrectly matched docComment). (Felipe)
 - Fixed bug #50087 (NSAPI performance improvements). (Uwe Schindler)
 - Fixed bug #50152 (ReflectionClass::hasProperty behaves like isset() not
   property_exists). (Felipe)

Added: php/php-src/branches/PHP_5_3/Zend/tests/bug50174.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug50174.phpt                       
        (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug50174.phpt       2009-11-14 
19:17:22 UTC (rev 290752)
@@ -0,0 +1,31 @@
+--TEST--
+Bug #50174 (Incorrectly matched docComment)
+--FILE--
+<?php
+
+class TestClass
+{
+       /** const comment */
+       const C = 0;
+
+       function x() {}
+}
+
+$rm = new ReflectionMethod('TestClass', 'x');
+var_dump($rm->getDocComment());
+
+class TestClass2
+{
+       /** const comment */
+       const C = 0;
+
+       public $x;
+}
+
+$rp = new ReflectionProperty('TestClass2', 'x');
+var_dump($rp->getDocComment());
+
+?>
+--EXPECT--
+bool(false)
+bool(false)


Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/bug50174.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_compile.c    2009-11-14 19:06:01 UTC 
(rev 290751)
+++ php/php-src/branches/PHP_5_3/Zend/zend_compile.c    2009-11-14 19:17:22 UTC 
(rev 290752)
@@ -3658,6 +3658,12 @@
                zend_error(E_COMPILE_ERROR, "Cannot redefine class constant 
%s::%s", CG(active_class_entry)->name, var_name->u.constant.value.str.val);
        }
        FREE_PNODE(var_name);
+
+       if (CG(doc_comment)) {
+               efree(CG(doc_comment));
+               CG(doc_comment) = NULL;
+               CG(doc_comment_len) = 0;
+       }
 }
 /* }}} */


Added: php/php-src/trunk/Zend/tests/bug50174.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug50174.phpt                          (rev 0)
+++ php/php-src/trunk/Zend/tests/bug50174.phpt  2009-11-14 19:17:22 UTC (rev 
290752)
@@ -0,0 +1,31 @@
+--TEST--
+Bug #50174 (Incorrectly matched docComment)
+--FILE--
+<?php
+
+class TestClass
+{
+       /** const comment */
+       const C = 0;
+
+       function x() {}
+}
+
+$rm = new ReflectionMethod('TestClass', 'x');
+var_dump($rm->getDocComment());
+
+class TestClass2
+{
+       /** const comment */
+       const C = 0;
+
+       public $x;
+}
+
+$rp = new ReflectionProperty('TestClass2', 'x');
+var_dump($rp->getDocComment());
+
+?>
+--EXPECT--
+bool(false)
+bool(false)


Property changes on: php/php-src/trunk/Zend/tests/bug50174.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c       2009-11-14 19:06:01 UTC (rev 
290751)
+++ php/php-src/trunk/Zend/zend_compile.c       2009-11-14 19:17:22 UTC (rev 
290752)
@@ -3803,6 +3803,12 @@
                zend_error(E_COMPILE_ERROR, "Cannot redefine class constant 
%v::%R", CG(active_class_entry)->name, Z_TYPE(var_name->u.constant), 
Z_UNIVAL(var_name->u.constant));
        }
        FREE_PNODE(var_name);
+
+       if (CG(doc_comment).v) {
+               efree(CG(doc_comment).v);
+               CG(doc_comment) = NULL_ZSTR;
+               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