This thread shows in lots of search results, so just to extend the answer 
just a little bit...

A Component was throwing the same error on Cake 2.2.1 and PHP 5.4.6. I 
figured it was because I added the startup() method, but forgot to 
type-hint the class of the parameter (Controller).

Basically, instead of:

function startup( ){ 

}

you should use:

*public *function startup( *Controller *$Controller) {

}

Without the *public* keyword, method still works for me (the public 
visibility is then inherited). If I use "private", "static", "protected", 
etc., error occurs. If I use "final", the method still works.
Which all makes big sense from OOP point of view.

If I remove the *Controller* type hint in the method property declaration, 
PHP throws error. PHP got really strict on method visibility and overrides 
since 5.2+. 

Further reading about PHP objects: 
visibility<http://www.php.net/manual/en/language.oop5.visibility.php>, 
inheritance <http://www.php.net/manual/en/language.oop5.inheritance.php>, type 
hinting <http://www.php.net/manual/en/language.oop5.typehinting.php>

When extending Core classes and writing callbacks (or overriding some other 
methods), it's always good to check (and copy) the methods you're 
overriding. This way you always have strong declarations, visibility and 
parameters are in check (and conventionally named). You also catch a 
glimpse of core code, which is always good. :)


On Friday, August 17, 2012 5:19:51 AM UTC+2, che_anj wrote:
>
> Hi traedamatic,
>
> I have the same problem, how did u resolve this issues. 
>
> thank you very much
>
>
>
> On Friday, March 23, 2012 10:33:24 PM UTC+8, traedamatic wrote:
>>
>> Problem SOLVED! 
>>
>> *php 5.4 needs public and private keywords with function and 
>> attributes!!!*
>>
>> Am Mittwoch, 21. März 2012 10:20:55 UTC+1 schrieb traedamatic:
>>>
>>> Hello,
>>>
>>> I have a strange problem. I run on Cakephp 2.1 App on PHP 5.4 and 
>>> 5.3.10. 
>>> On PHP 5.3.10 is everything fine but on 5.4 i get this error:
>>>
>>> *Fatal error*: Class 'Debugger' not found in *
>>> /***/beta/app/Plugin/Markitup/View/Helper/MarkitupHelper.php *on line 
>>> *161*
>>> *
>>> *
>>> The line 161 is the last line of the file.
>>>
>>> The head of the Helper looks like this:
>>>
>>> App::import('Core', 'Debugger');
>>> App::uses('AppHelper', 'View/Helper');
>>>
>>> class MarkitupHelper extends AppHelper {
>>> ...
>>>
>>> The funny think is that happens although with the DebugKit Plugin. 
>>>
>>> Does anyone have the same problem?
>>>
>>> Does anyone had the same Problem?
>>>
>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to