diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 0404b6537dd..47e0795a899 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1756,6 +1756,10 @@ send_by_ref: zval *varptr; varptr_ptr = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_W); + if (!varptr_ptr) { + zend_error(E_ERROR, "Only variables can be passed by reference"); + } + varptr = *varptr_ptr; if (!PZVAL_IS_REF(varptr)) {