From ad370ff72bd28ebbcb1087138c926ef93eab394b Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 5 Sep 2017 12:27:38 +0200 Subject: [PATCH] context: avoid duplicate registration of enum constants --- src/context.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/context.c b/src/context.c index ea36917..bc3fb45 100644 --- a/src/context.c +++ b/src/context.c @@ -340,6 +340,11 @@ zend_function_entry *psi_context_compile(struct psi_context *C) name = strpprintf(0, "psi\\%s\\%s", e->name, item->name); } + if (zend_get_constant(name)) { + zend_string_release(name); + continue; + } + zc.name = zend_string_dup(name, 1); ZVAL_LONG(&zc.value, psi_long_num_exp(item->num, NULL, NULL)); zend_register_constant(&zc); -- 2.30.2