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 ea36917cceca41aa75d4f25406a3c91067dab8d9..bc3fb4506bdd125012885e9e1274c824ccae1137 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);