]> granicus.if.org Git - php/commitdiff
- Fixed bug #50174 (Incorrectly matched docComment)
authorFelipe Pena <felipe@php.net>
Sat, 14 Nov 2009 19:17:22 +0000 (19:17 +0000)
committerFelipe Pena <felipe@php.net>
Sat, 14 Nov 2009 19:17:22 +0000 (19:17 +0000)
Zend/tests/bug50174.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/Zend/tests/bug50174.phpt b/Zend/tests/bug50174.phpt
new file mode 100644 (file)
index 0000000..6ed5733
--- /dev/null
@@ -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)
index e61b01f97bc6e2946499278686a7dbbb6723b04b..00f46cc37aa8b0bd48c864af9a03276c7f0fb766 100644 (file)
@@ -3803,6 +3803,12 @@ void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_D
                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;
+       }
 }
 /* }}} */