Hi
Am 2026-01-22 00:33, schrieb Ilija Tovilo:
No strong opinions on my part, but I'd like to point out that similar
situations already exist.
https://3v4l.org/ARMMS#v8.4.14
const C = [1, 2, 3];
function foo(): array {
return C;
}
foo()[] = 4;
var_dump(C);
PHP will happily duplicate the array returned from foo() to append 4,
without warning. The original array in C remains unmodified. It might
I'm aware. However to me this situation is a little different,
intuition-wise: A return value already looks and feels like a temporary
value to me (unless a by-ref return is used, of course, but those are
rare). An access on a const does not.
make sense for ASSIGN_DIM to warn/throw if OP1 is not a "pointer"
(indirect, reference or object), as then the operation will never have
an effect. But it seems to me this is a distinct issue.
That makes sense to me and IMO is a necessary precursor for this.
Best regards
Tim Düsterhus