[TYPO3-core] bugreport about hooks, $this, tcemain infinite loops
Dmitry Dulepov
9f4eetb02 at sneakemail.com
Thu May 24 09:17:22 CEST 2007
Hi!
Kasper Skårhøj wrote:
> Lesson learned:
> When setting up hooks it is quite natural to find the hook call in the
> core and then copy/paste the
> hook function call as a template for the function in the hook class you
> are going to create. The
> danger is that if the parent (caller) object, $this, is passed along you
> may forget to rename it to -
> typically - &$pObj. And as this case shows it will not yield an error
> message and may induce a
> puzzling problem to solve later. Remember to rename “$this” to “&$pObj”
> when using hooks!
Yes, this happens... When I used phpEclipse, it was clever enough to
warn me about using reserved word as a parameter name. In fact, these
warnings from various IDEs are very good. For example, there is a
[pending] warning somewhere in typo3/sysext/cms/ that parameter is
passed to user function and such parameter is never defined. Looks like
no harm done so far (no one complained) but the fact is not very pleasant.
--
Dmitry Dulepov
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"It is our choices, that show what we truly are,
far more than our abilities." (A.P.W.B.D.)
More information about the TYPO3-team-core
mailing list