Skip to content

Commit 521c405

Browse files
committed
Don't index NULL pointer when fetching non-existent constant
1 parent ac9a265 commit 521c405

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Zend/zend_constants.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,15 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
454454
}
455455
}
456456

457-
if (!(flags & ZEND_FETCH_CLASS_SILENT)) {
458-
if (!c) {
457+
if (!c) {
458+
if (!(flags & ZEND_FETCH_CLASS_SILENT)) {
459459
zend_throw_error(NULL, "Undefined constant '%s'", name);
460-
} else if (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED) {
461-
zend_error(E_DEPRECATED, "Constant %s is deprecated", name);
462460
}
461+
return NULL;
462+
}
463+
464+
if (!(flags & ZEND_FETCH_CLASS_SILENT) && (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED)) {
465+
zend_error(E_DEPRECATED, "Constant %s is deprecated", name);
463466
}
464467
return &c->value;
465468
}

0 commit comments

Comments
 (0)