1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

16 Commits

Author SHA1 Message Date
Ilija Tovilo
daeb3295b2 Improve readonly avis error (GH-15618)
We don't track whether protected(set) is implicit, so for now always point out
when the property is readonly in the error message.
2024-08-29 13:19:31 +02:00
Ilija Tovilo
8df557ac42 [RFC] Asymmetric visibility v2 (GH-15063)
Co-authored-by: Larry Garfield <larry@garfieldtech.com>
2024-08-27 02:04:48 +02:00
Ilija Tovilo
46ee0fb304 Disallow indirect modification on readonly properties within __clone() (#15012)
Indirect modification isn't allowed in __construct() because it allows
references to leak, so it doesn't make much sense to allow it in __clone().
2024-08-09 11:56:16 +02:00
Ilija Tovilo
fdbe910b3b Fix indirect readonly error messages (#14979)
$obj->ro[] = 42;, passByRef($obj->ro); and the likes should emit an indirect
modification error message. This message already existed but was used
inconsistently.
2024-07-16 23:24:07 +02:00
Máté Kocsis
04a5f2b11f Add test to make sure that readonly properties cannot be reassigned by invoking the __clone() method directly 2023-04-25 17:17:05 +02:00
Ilija Tovilo
3f7dadfeca Fix readonly+clone JIT issues
Closes GH-10748
2023-03-07 13:20:52 +01:00
Máté Kocsis
e053ba0a3a Do not allow side-effects when readonly property modification fails (#10757) 2023-03-03 19:53:42 +01:00
Máté Kocsis
dab783f7ae Fix operator precedence in the skip section of readonly tests 2023-03-03 13:01:36 +01:00
Ilija Tovilo
ccc16b45ef [skip ci] Skip failing readonly+clone tests for JIT for now
See implementation at GH-10748
2023-03-03 10:43:20 +01:00
Máté Kocsis
3bcf2c3755 Allow readonly properties to be reinitialized once during cloning (#10389)
RFC: https://wiki.php.net/rfc/readonly_amendments
2023-02-28 22:54:38 +01:00
Ilija Tovilo
adfdfb2e1e Improvements in modifier parsing (#9926)
Use a shared non-terminal for all class modifiers. This avoids conflicts when
adding modifiers that are only valid for certain targets. This change is
necessary for asymmetric visibility but might be useful for other future
additions.

Closes GH-9926
2022-11-17 16:20:27 +01:00
Ilija Tovilo
110573726b Disallow assigning reference to unset readonly property
Closes GH-7942
Closes GH-8188
2022-07-01 12:16:32 +02:00
Nikita Popov
4796183958 Add missing scope check for readonly prop initialization
If the initializing assignment is an array append we will go through
the UNDEF codepath of get_property_ptr_ptr, which did not verify
that the initialization scope is valid.
2021-09-17 11:20:29 +02:00
Máté Kocsis
3babe9576e Validate that promoted readonly properties have a type 2021-07-25 13:13:19 +02:00
Nikita Popov
11b990f848 Forbid multiple readonly modifiers
Same as for other modifiers.
2021-07-21 12:19:06 +02:00
Nikita Popov
6780aaa532 Implement readonly properties
Add support for readonly properties, for which only a single
initializing assignment from the declaring scope is allowed.

RFC: https://wiki.php.net/rfc/readonly_properties_v2

Closes GH-7089.
2021-07-20 12:05:46 +02:00