]> granicus.if.org Git - php/commit
Fetch for read in nested property assignments
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 10 Mar 2020 09:50:17 +0000 (10:50 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 18 Mar 2020 11:08:06 +0000 (12:08 +0100)
commitbb43a3822e42dbd15b1d416a166549d3980b379a
treef3a95f859229e014c5fb9a802b8f817d23c52f81
parente957a8cd9263a2bad1317ac7f88b9cda04081bdc
Fetch for read in nested property assignments

    $a->b->c = 'd';

is now compiled the same way as

    $b = $a->b;
    $b->c = 'd';

That is, we perform a read fetch on $a->b, rather than a write
fetch.

This is possible, because PHP 8 removed auto-vivification support
for objects, so $a->b->c = 'd' may no longer modify $a->b proper
(i.e. not counting interior mutability of the object).

Closes GH-5250.
15 files changed:
UPGRADING
Zend/tests/033.phpt
Zend/tests/bug41813.phpt
Zend/tests/bug41919.phpt
Zend/tests/bug47704.phpt
Zend/tests/bug52041.phpt
Zend/tests/bug75921.phpt
Zend/tests/bug78531.phpt
Zend/zend_compile.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
Zend/zend_vm_handlers.h
Zend/zend_vm_opcodes.c
ext/simplexml/tests/bug35785.phpt
ext/simplexml/tests/bug41582.phpt