Re: [PHP-DEV] [RFC] [Discussion] Readonly class amendments

2022-11-27 Thread G. P. B.
On Sat, 26 Nov 2022 at 23:06, Marco Pivetta wrote: > On Sat, 26 Nov 2022, 23:56 G. P. B., wrote: > >> As all the invariants will be maintained in the child classes >> > The invariant here is the immutability from a behavioural PoV. > LSP has 100% been broken in that example. > I've gone back to

Re: [PHP-DEV] [RFC] [Discussion] Readonly class amendments

2022-11-27 Thread Nicolas Grekas
The code that Marco (Pivetta) shared was supposed to illustrate how readonly classes can be useful to enforce some invariants on child classes. Yet, here is another implementation that does use a readonly child class, but still provides the behavior that was supposedly prevented by the keyword: re

Re: [PHP-DEV] [RFC] [Discussion] Readonly class amendments

2022-11-27 Thread Larry Garfield
On Sat, Nov 26, 2022, at 6:35 PM, Jordan LeDoux wrote: > On Sat, Nov 26, 2022 at 3:40 PM Deleu wrote: > >> >> As I think more about this, there's nothing about the current RFC in this >> code sample. What's breaking LSP here is the child class doing state >> modification, not PHP. To further expa

[PHP-DEV] zval_ptr_dtor_str(return_value)

2022-11-27 Thread Thomas Hruska
In ext/standard/file.c, when php_stream_read_to_str() fails, fread() calls: zval_ptr_dtor_str(return_value); Is there ever a situation where return_value can be a string that has to be freed? -- Thomas Hruska CubicleSoft President CubicleSoft has over 80 original open source projects and co