]> granicus.if.org Git - php/commitdiff
Don't index NULL pointer when fetching non-existent constant
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 28 Jan 2020 10:16:53 +0000 (11:16 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 28 Jan 2020 10:20:57 +0000 (11:20 +0100)
Zend/zend_constants.c

index 0885525676bff5f9c340902978b2c72b4522528a..958bd36d1dab5f40b7d4070546e9ac60a995c25a 100644 (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);
-               } 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;
 }