From 460bbc8ebe70b700a9eb47884dc6a4866db2dd5c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 24 Apr 2022 18:20:46 +0200 Subject: [PATCH] Add clarifying comment for SEND_VAL usage This confused me for a bit, because we're using SEND_VAL here to potentially perform a by-ref SEND, while it is usually used for by-val SENDs. --- Zend/zend_compile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a2098a4decc..e0ee212a6b1 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3487,6 +3487,9 @@ static uint32_t zend_compile_args( if (ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) { opcode = ZEND_SEND_VAR_NO_REF; } else if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) { + /* For IS_VAR operands, SEND_VAL will pass through the operand without + * dereferencing, so it will use a by-ref pass if the call returned by-ref + * and a by-value pass if it returned by-value. */ opcode = ZEND_SEND_VAL; } else { opcode = ZEND_SEND_VAR;