context: avoid duplicate registration of enum constants
[m6w6/ext-psi] / src / context.c
index 6408ebeec29f374138237de87301bf4292110d38..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);
@@ -380,7 +385,7 @@ ZEND_RESULT_CODE psi_context_call(struct psi_context *C, zend_execute_data *exec
                return FAILURE;
        }
 
-       psi_call_frame_do_call(frame);
+       C->ops->call(frame);
 
        if (SUCCESS != psi_call_frame_do_assert(frame, PSI_ASSERT_POST)) {
                psi_call_frame_do_return(frame, return_value);