]> granicus.if.org Git - php/commitdiff
Fix crash during default value evaluation
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 18 Feb 2021 15:44:10 +0000 (16:44 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 18 Feb 2021 15:44:10 +0000 (16:44 +0100)
Zend/zend_compile.c

index df88d34a6ff7ef61042cc2cde9ce1f9804602158..15bc64783d9b37035be6a029491ade778d49d0a1 100644 (file)
@@ -1512,6 +1512,11 @@ static bool zend_try_ct_eval_const(zval *zv, zend_string *name, bool is_fully_qu
 
 static inline bool zend_is_scope_known() /* {{{ */
 {
+       if (!CG(active_op_array)) {
+               /* This can only happen when evaluating a default value string. */
+               return 0;
+       }
+
        if (CG(active_op_array)->fn_flags & ZEND_ACC_CLOSURE) {
                /* Closures can be rebound to a different scope */
                return 0;