note 108604 added to language.oop5.traits
| From: | ryanhanekamp at yahoo dot com | Date: | Thu, 10 May 2012 00:14:36 +0000 |
| Subject: | note 108604 added to language.oop5.traits | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187560@lists.php.net to get a copy of this message | ||
Using AS on a __construct method (and maybe other magic methods) is really, really bad. The problem
is that is doesn't throw any errors, at least in 5.4.0. It just sporadically resets the
connection. And when I say "sporadically," I mean that arbitrary changes in the preceding
code can cause the browser connection to reset or not reset *consistently*, so that subsequent page
refreshes will continue to hang, crash, or display perfectly in the same fashion as the first load
of the page after a change in the preceding code, but the slightest change in the code can change
this state. (I believe it is related to precise memory usage.)
I've spent a good part of the day chasing down this one, and weeping every time commenting or
even moving a completely arbitrary section of code would cause the connection to reset. It was just
by luck that I decided to comment the
"__construct as primitiveObjectConstruct"
line and then the crashes went away entirely.
My parent trait constructor was very simple, so my fix this time was to copy the functionality into
the child __construct. I'm not sure how I'll approach a more complicated parent trait
constructor.
----
Server IP: 192.41.42.26
Probable Submitter: 98.250.172.237
----
Manual Page -- http://www.php.net/manual/en/language.oop5.traits.php
Edit -- https://master.php.net/note/edit/108604
Del: integrated -- https://master.php.net/note/delete/108604/integrated
Del: useless -- https://master.php.net/note/delete/108604/useless
Del: bad code -- https://master.php.net/note/delete/108604/bad+code
Del: spam -- https://master.php.net/note/delete/108604/spam
Del: non-english -- https://master.php.net/note/delete/108604/non-english
Del: in docs -- https://master.php.net/note/delete/108604/in+docs
Del: other reasons-- https://master.php.net/note/delete/108604
Reject -- https://master.php.net/note/reject/108604
Search -- https://master.php.net/manage/user-notes.php