Warning after update to 2.0

  • Posts: 5
  • Thank you received: 0
6 years 5 months ago #281245

-- HikaShop version -- : 3.2.1
-- HikaMarket version -- : 2.0
-- Joomla version -- : 3.8.1
-- PHP version -- : 7
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : Warning: Parameter 1 to plgHikamarketVendorlocationfilter::onBeforeVendorListingDisplay() expected to be a reference, value given in P:\Programs\XAMPP\htdocs\globaltest\libraries\joomla\event\event.php on line 70

Hi all,
it's not a critical bug, it's just a new warning that came up after the upgrade to HikaMarket 2.0 and I wanted you to know.
It's within the vendorlocationfilter Plugin. HikaShop Plugin has no warnings at all. :-)

Regards,
Fabio

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 5 months ago #281252

Hello,

I'm sorry but the function in the plugin is

public function onBeforeVendorListingDisplay(&$view, &$params) {
And the trigger is called in one single file and its code is
JFactory::getApplication()->triggerEvent('onBeforeVendorListingDisplay', array(&$this, &$trigger_params));
So both are using a reference for the first parameter.

I don't know if you have custom code but I cannot see the issue you're describing.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
6 years 5 months ago #281266

Hello Jerome, thanks again for your quick reply.

You're totally right here, the call that seems to make problems is event.php in joomla libraries. I did do some modifications, that's why I also tried on a clean installation. Same issue. I'm not a php developer and I'm currently digging myself into this. I now think it's probably not a HikaShop issue but I thought maybe you'd see the issue right away.

The call which produces the warning is following:

return call_user_func_array(array($this, $event), $args);

$args should be an array reference as here is the complete code snippet
/**
	 * Method to trigger events.
	 * The method first generates the even from the argument array. Then it unsets the argument
	 * since the argument has no bearing on the event handler.
	 * If the method exists it is called and returns its return value. If it does not exist it
	 * returns null.
	 *
	 * @param   array  &$args  Arguments
	 *
	 * @return  mixed  Routine return value
	 *
	 * @since   11.1
	 */
	public function update(&$args)
	{
		// First let's get the event from the argument array.  Next we will unset the
		// event argument as it has no bearing on the method to handle the event.
		$event = $args['event'];
		unset($args['event']);

		/*
		 * If the method to handle an event exists, call it and return its return
		 * value.  If it does not exist, return null.
		 */
		if (method_exists($this, $event))
		{
			return call_user_func_array(array($this, $event), $args);
		}
	}

As I already said I'm a newbie in php. I tried to pass &$args instead of $args, but this resulted in an invalid php file.
I'd appreciate any quick suggestion how to approach such a happening.

Best Regards,
Fabio

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 5 months ago #281275

Hello,

So if it's related to Joomla itself ; you should report the warning to Joomla.
There is nothing I can do in HikaMarket since it using the same code than in the Joomla core :
github.com/joomla/joomla-cms/blob/bcf386...oduleHelper.php#L272
github.com/joomla/joomla-cms/blob/6e07ca...ls/searches.php#L151
github.com/joomla/joomla-cms/blob/7ab744...pers/fields.php#L459
( etc )

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.063 seconds
Powered by Kunena Forum