Page 1 of 1

Error messages

Posted: 29 Apr 2011, 23:34
by Vaffanclick
I got the following message:

Code: Select all

Strict Standards: Non-static method JSite::getMenu() should not be called statically in [...]/components/com_phocadownload/router.php on line 38
Why the author decided to call it statically?

Re: Error messages

Posted: 03 May 2011, 00:02
by Jan
Hi, you should disable Strict Standards in your php settings.
Why the author decided to call it statically?
If you code over 100.000 lines of code which needed to work in php4, in fact there is no chance to follow strict standards recommendations. :( :(

Strict Standards should be enabled only for developers.

Jan

Re: Error messages

Posted: 21 May 2011, 00:25
by Vaffanclick
Thank you for your reply. I admire you.
However, never mind the remaining 99.999 lines of code.
I am interested in /components/com_phocadownload/router.php, line 38.

Code: Select all

$menu           = &JSite::getMenu();
I think that it could be replaced with the following code:

Code: Select all

$site = new JSite();
$menu = $site->getMenu();
should it run on php 4?
Is there a particular reason for you to prefer the "static call"?

Re: Error messages

Posted: 23 May 2011, 17:12
by Jan
Hi,
Is there a particular reason for you to prefer the "static call"?
in fact no, this is only a habit, Joomla! has a lot of static functions, e.g. JText::_() is called everywhere, in fact you will find the static functions in all code of Joomla! This is why I didn't "think" about the using not static function in this case.

But yes, if the method can be called standard way, why not use it (didn't do tests if running contructor is better than to run only the one static function (mostly singleton used) - in memory, speed, etd. area) :idea: