Bug #78226 [PATCH]: Unexpected __set behavior with typed properties
| From: | nikic@php.net | Date: | Wed, 11 Sep 2019 09:54:57 +0000 |
| Subject: | Bug #78226 [PATCH]: Unexpected __set behavior with typed properties | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222691@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78226&edit=1
ID: 78226
Patch added by: nikic@php.net
Reported by: dirk dot gerigk at tui dot com
Summary: Unexpected __set behavior with typed properties
Status: Assigned
Type: Bug
Package: Class/Object related
Operating System: Linux
PHP Version: 7.4Git-2019-06-28 (Git)
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Don't invoke __set() on accessible declared but unset properties
On GitHub: https://github.com/php/php-src/pull/4696
Patch: https://github.com/php/php-src/pull/4696.patch
Previous Comments:
------------------------------------------------------------------------
[2019-08-18 13:26:50] nikic@php.net
I think we'll have to change the semantics of __set to not be called for properties that are
declared but unset (or uninitialized).
------------------------------------------------------------------------
[2019-08-14 12:47:32] tandrewbennett at hotmail dot com
For what it's worth, I think that a lot of the use cases for using __set() in userland code are
based on devs trying to roll their own property accessor syntax for their entities, value objects,
etc. I think this new behavior would be a non issue if we had something like this: https://wiki.php.net/rfc/propertygetsetsyntax-v1.2
I know there are differing opinions regarding the specific syntax (some prefer a C# style syntax
while other prefer an ES6 based approach), but I still think it's worth mentioning here,
perhaps for future releases.
------------------------------------------------------------------------
[2019-08-13 20:51:44] nikic@php.net
Related To: Bug #78411
------------------------------------------------------------------------
[2019-08-05 07:55:14] nikic@php.net
Related To: Bug #78372
------------------------------------------------------------------------
[2019-07-23 07:08:58] wanghao at imwh dot net
The behavior is quite surprising.It make me upset.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=78226
--
Edit this bug report at https://bugs.php.net/bug.php?id=78226&edit=1