+ if (D->consts) {
+ zend_constant zc;
+
+ zc.flags = CONST_PERSISTENT|CONST_CS;
+ zc.module_number = EG(current_module)->module_number;
+
+ for (i = 0; i < D->consts->count; ++i) {
+ constant *c = D->consts->list[i];
+
+ zc.name = zend_string_init(c->name + (c->name[0] == '\\'), strlen(c->name) - (c->name[0] == '\\'), 1);
+ ZVAL_NEW_STR(&zc.value, zend_string_init(c->val->text, strlen(c->val->text), 1));
+
+ switch (c->type->type) {
+ case PSI_T_BOOL:
+ convert_to_boolean(&zc.value);
+ break;
+ case PSI_T_INT:
+ convert_to_long(&zc.value);
+ break;
+ case PSI_T_FLOAT:
+ convert_to_double(&zc.value);
+ break;
+ }
+ zend_register_constant(&zc);
+ }
+ }
+