Don't index NULL pointer when fetching non-existent constant

This commit is contained in:
Nikita Popov 2020-01-28 11:16:53 +01:00
parent ac9a265f01
commit 521c405108

View File

@ -454,12 +454,15 @@ failure:
} }
} }
if (!(flags & ZEND_FETCH_CLASS_SILENT)) { if (!c) {
if (!c) { if (!(flags & ZEND_FETCH_CLASS_SILENT)) {
zend_throw_error(NULL, "Undefined constant '%s'", name); zend_throw_error(NULL, "Undefined constant '%s'", name);
} else if (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED) {
zend_error(E_DEPRECATED, "Constant %s is deprecated", name);
} }
return NULL;
}
if (!(flags & ZEND_FETCH_CLASS_SILENT) && (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED)) {
zend_error(E_DEPRECATED, "Constant %s is deprecated", name);
} }
return &c->value; return &c->value;
} }