context: avoid duplicate registration of enum constants
authorMichael Wallner <mike@php.net>
Tue, 5 Sep 2017 10:27:38 +0000 (12:27 +0200)
committerMichael Wallner <mike@php.net>
Tue, 5 Sep 2017 10:27:38 +0000 (12:27 +0200)
src/context.c

index ea36917..bc3fb45 100644 (file)
@@ -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);