Error messages

Phoca Download - download manager
Vaffanclick
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 29 Apr 2011, 17:17

Error messages

Post 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?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Error messages

Post 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
If you find Phoca extensions useful, please support the project
Vaffanclick
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 29 Apr 2011, 17:17

Re: Error messages

Post 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"?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Error messages

Post 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:
If you find Phoca extensions useful, please support the project
Post Reply