From: Michael Wallner Date: Tue, 5 Sep 2017 10:27:38 +0000 (+0200) Subject: context: avoid duplicate registration of enum constants X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=ad370ff72bd28ebbcb1087138c926ef93eab394b;p=m6w6%2Fext-psi context: avoid duplicate registration of enum constants --- 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);