Search code examples
phpjoomla

Strict standards error while using &JComponentHelper


I'm using virtuemart component in my project, The problem is with it's wishlist module which generates Strict standards error after payment is done! using AltaUser point as payment method it is weird that it works normally in other pages but just after payment the error comes up!

One of the lines that is in error list:

$com_params = &JComponentHelper::getParams('com_wishlist');

After putting this code

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Top of module file, I have error in all of the pages. which shows that I just didn't knew I had the error all the time everywhere


Solution

  • Strict standards aren't errors but notices to developers, and you shouldn't enable them in production sites. Anyway, you can know what is going by reading the specific messages stated in the strict standards notices.

    For instance for the code line you show:

    $com_params = &JComponentHelper::getParams('com_wishlist');
    

    you will likely view something like (in PHP 5.3 and later):

    PHP Strict Standards: Only variables should be assigned by reference in ...

    which you can solve changing it to:

    $com_params = JComponentHelper::getParams('com_wishlist');
    

    The solution to get rid of those strict standards notices depends then of every case.