From adfc96335a39e51af034f6d4b76dba77b25261d6 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 14 Nov 2009 19:17:22 +0000 Subject: [PATCH] - Fixed bug #50174 (Incorrectly matched docComment) --- Zend/tests/bug50174.phpt | 31 +++++++++++++++++++++++++++++++ Zend/zend_compile.c | 6 ++++++ 2 files changed, 37 insertions(+) create mode 100644 Zend/tests/bug50174.phpt diff --git a/Zend/tests/bug50174.phpt b/Zend/tests/bug50174.phpt new file mode 100644 index 0000000000..6ed5733b67 --- /dev/null +++ b/Zend/tests/bug50174.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #50174 (Incorrectly matched docComment) +--FILE-- +getDocComment()); + +class TestClass2 +{ + /** const comment */ + const C = 0; + + public $x; +} + +$rp = new ReflectionProperty('TestClass2', 'x'); +var_dump($rp->getDocComment()); + +?> +--EXPECT-- +bool(false) +bool(false) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index e61b01f97b..00f46cc37a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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; + } } /* }}} */ -- 2.40.0