#
6808968c |
| 05-Nov-2020 |
Nikita Popov |
Backport preloading trait fixup fixes This cherry-picks 33969c2252b2c33a72c9039072af8862fd347a5f and 2effbfd8713936742ef46e6e85ce193b320ac005 from PHP-8.0. The issues these comm
Backport preloading trait fixup fixes This cherry-picks 33969c2252b2c33a72c9039072af8862fd347a5f and 2effbfd8713936742ef46e6e85ce193b320ac005 from PHP-8.0. The issues these commits fix could also manifest in PHP 7.4, and a commenter on bug #80307 reports this this might indeed be happening.
show more ...
|
#
2effbfd8 |
| 05-Nov-2020 |
Nikita Popov |
Fixup trait methods even if no traits are used Trait methods might be non-trivially inherited, in which case we may have to perform fixup in classes that do not directly use any trai
Fixup trait methods even if no traits are used Trait methods might be non-trivially inherited, in which case we may have to perform fixup in classes that do not directly use any traits.
show more ...
|
#
33969c22 |
| 05-Nov-2020 |
Nikita Popov |
Fix multiple trait fixup If a trait method is inherited, preloading trait fixup might be performed on it multiple times. Usually this is fine, because the opcodes pointer will have a
Fix multiple trait fixup If a trait method is inherited, preloading trait fixup might be performed on it multiple times. Usually this is fine, because the opcodes pointer will have already been updated, and will thus not be found in the xlat table. However, it can happen that the new opcodes pointer is the same as one of the old opcodes pointers, if the pointer has been reused by the allocator. In this case we will look up the wrong op array and overwrite the trait method with an unrelated trait method. We fix this by indexing the xlat table not by the opcodes pointer, but by the refcount pointer. The refcount pointer is not changed during optimization, and accurately represents which op arrays should use the same opcodes. Fixes bug #80307. The test case does not reproduce the bug, because this depends on a lot of "luck" with the allocator. The test case merely illustrates a case where orig_op_array would have been NULL in the original code.
show more ...
|