{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii-core/issues/41","repository_url":"https://api.github.com/repos/yiisoft/yii-core","labels_url":"https://api.github.com/repos/yiisoft/yii-core/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii-core/issues/41/comments","events_url":"https://api.github.com/repos/yiisoft/yii-core/issues/41/events","html_url":"https://github.com/yiisoft/yii-core/issues/41","id":368328636,"node_id":"MDU6SXNzdWUzNjgzMjg2MzY=","number":41,"title":"Allow to set undefined properties in yii\\base\\Object ","user":{"login":"move[bot]","id":33596368,"node_id":"MDM6Qm90MzM1OTYzNjg=","avatar_url":"https://avatars1.githubusercontent.com/in/6673?v=4","gravatar_id":"","url":"https://api.github.com/users/move%5Bbot%5D","html_url":"https://github.com/apps/move","followers_url":"https://api.github.com/users/move%5Bbot%5D/followers","following_url":"https://api.github.com/users/move%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/move%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/move%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/move%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/move%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/move%5Bbot%5D/repos","events_url":"https://api.github.com/users/move%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/move%5Bbot%5D/received_events","type":"Bot","site_admin":false},"labels":[{"id":1042977842,"node_id":"MDU6TGFiZWwxMDQyOTc3ODQy","url":"https://api.github.com/repos/yiisoft/yii-core/labels/status:under%20discussion","name":"status:under discussion","color":"f7c6c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-10-09T18:00:22Z","updated_at":"2018-10-09T18:00:30Z","closed_at":null,"author_association":"NONE","body":"*@mikehaertl commented on Mar 7, 2018, 11:28 AM UTC:*\n\nI have to come back to my closed issue [#12021](https://github.com/yiisoft/yii2/issues/12021). It seems that this is still not fixed in Yii 2.1.\n\nMy description and use case there is still valid.\n\nThe outcome of [#12021](https://github.com/yiisoft/yii2/issues/12021) was, that this should be implemented via a trait. But it seems this never happened in 2.1.\n\n**tl;dr**: I want to use the magic getter/setter methods from `yii\\base\\BaseObject` to be available in my custom classes. But I don't want that this changes PHP's default behavior, where you can also set undefined properties on a class.\n\n```text-html-php\n<?php\nclass X\n{\n}\n\n$x = new X;\n$x->demo = 'x';   // No error, PHP allows to have dynamic properties\n\necho $x->wtf;  // Error, because 'wtf' was not set yet.\n```\n\nYii changes this default behavior of PHP:\n\n```text-html-php\n<?php\nclass X extends yii\\base\\BaseObject\n{\n}\n\n$x = new X;\n\n// This will throw an error:\n$x->demo = 'x';\n```\n\n*This issue was moved by [samdark](https://github.com/samdark) from [yiisoft/yii2#15845](https://github.com/yiisoft/yii2/issues/15845).*"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii-core/issues/comments/428290329","html_url":"https://github.com/yiisoft/yii-core/issues/41#issuecomment-428290329","issue_url":"https://api.github.com/repos/yiisoft/yii-core/issues/41","id":428290329,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODI5MDMyOQ==","user":{"login":"move[bot]","id":33596368,"node_id":"MDM6Qm90MzM1OTYzNjg=","avatar_url":"https://avatars1.githubusercontent.com/in/6673?v=4","gravatar_id":"","url":"https://api.github.com/users/move%5Bbot%5D","html_url":"https://github.com/apps/move","followers_url":"https://api.github.com/users/move%5Bbot%5D/followers","following_url":"https://api.github.com/users/move%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/move%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/move%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/move%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/move%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/move%5Bbot%5D/repos","events_url":"https://api.github.com/users/move%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/move%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2018-10-09T18:00:30Z","updated_at":"2018-10-09T18:00:30Z","author_association":"NONE","body":"*@mikehaertl commented on Mar 8, 2018, 9:54 AM UTC:*\n\n[SilverFire](https://github.com/SilverFire) You mean an empty interface (`interface LooseGetSetInterface {}`) that's only used to flag certain classes? I like that idea. It's also straightforward to check for that in the magic method."}}
{"actor":{"display_login":"move"}}