Skip to content

Commit

Permalink
fix incorrect usage of zend_declare_class_constant_ex
Browse files Browse the repository at this point in the history
  • Loading branch information
krakjoe authored and dzuelke committed Jun 6, 2019
1 parent 843f5c8 commit c072696
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions kernels/ZendEngine3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,20 @@ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t
{
#if PHP_VERSION_ID >= 70100
int ret;
zend_string *key;

if (ce->type == ZEND_INTERNAL_CLASS) {
key = zend_string_init_interned(name, name_length, 1);
} else {
key = zend_string_init(name, name_length, 0);
}

zend_string *key = zend_string_init(name, name_length, ce->type & ZEND_INTERNAL_CLASS);
ret = zend_declare_class_constant_ex(ce, key, value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(key);

if (ce->type != ZEND_INTERNAL_CLASS) {
zend_string_release(key);
}

return ret;
#else
if (Z_CONSTANT_P(value)) {
Expand Down

0 comments on commit c072696

Please sign in to comment.