SET_RESULT_BOT(result);
}
return;
+ case ZEND_ASSIGN_STATIC_PROP_REF:
+ case ZEND_ASSIGN_OBJ_REF:
+ /* Handled here because we also need to BOT the OP_DATA operand, while the generic
+ * code below will not do so. */
+ SET_RESULT_BOT(result);
+ SET_RESULT_BOT(op1);
+ SET_RESULT_BOT(op2);
+ opline++;
+ ssa_op++;
+ SET_RESULT_BOT(op1);
+ break;
}
if ((op1 && IS_BOT(op1)) || (op2 && IS_BOT(op2))) {
SET_RESULT_BOT(result);
break;
}
- case ZEND_ASSIGN_STATIC_PROP_REF:
- case ZEND_ASSIGN_OBJ_REF:
- SET_RESULT_BOT(result);
- SET_RESULT_BOT(op1);
- SET_RESULT_BOT(op2);
- opline++;
- ssa_op++;
- op1 = get_op1_value(ctx, opline, ssa_op);
- SET_RESULT_BOT(op1);
- break;
default:
{
/* If we have no explicit implementation return BOT */
--- /dev/null
+--TEST--
+SCCP 029: Don't propagate assignments to references to typed properties
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+opcache.preload=
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class Test {
+ public string $x = "x";
+}
+function test() {
+ $test = new Test();
+ $ref = "y";
+ $test->x =& $ref;
+ $ref = 42;
+ var_dump($ref);
+}
+test();
+
+?>
+--EXPECT--
+string(2) "42"