compat: PHP-7.2
[m6w6/ext-psi] / src / context.c
index ea36917cceca41aa75d4f25406a3c91067dab8d9..73422be98df3b03de2d35595e511f06179bd1654 100644 (file)
@@ -85,7 +85,7 @@ struct psi_context *psi_context_init(struct psi_context *C, struct psi_context_o
        assert(ops->call != NULL);
        assert(ops->compile != NULL);
 
-       /* build up predefs in a temporary PSI_Data for validation */
+       /* build up predefs in a temporary psi_data for validation */
        memset(&T, 0, sizeof(T));
        psi_data_ctor_with_dtors(&T, error, flags);
 
@@ -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);