VirtueMart

WooCommerce

Others

Docs

Support

Demo

Blog

About

Forum
Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Warning: array_merge() expects at least 1 paramete

Warning: array_merge() expects at least 1 paramete 10 Jun 2017 16:13 #1

Hi i am getting an error

Warning: array_merge() expects at least 1 parameter, 0 given in .../public_html/plugins/vmshipment/rules_shipping_advanced/rules_shipping_framework_joomla.php on line 40

i use Joomla! 3.7.2
php 7.1.
virtuemart VirtueMart 3.2.2
The administrator has disabled public write access.

Warning: array_merge() expects at least 1 paramete 19 Jun 2017 01:17 #2

Dear CapoGr,
Thank you for reporting this warning message. This is indeed a little coding error (functionality of the plugin is not impeded at all, just this ugly warning is printed, because we "forgot" to check whether the return value of a function was an empty list or not) and will be fixed in the next version. We don't have any ETA for the next version yet. If you need this warning to disappear as soon as possible, you can manually apply the change yourself. Here is the diff:
diff --git a/rules_shipping_framework_joomla.php b/rules_shipping_framework_joomla.php
index eeb6f71..eea9dec 100644
--- a/rules_shipping_framework_joomla.php
+++ b/rules_shipping_framework_joomla.php
@@ -37,7 +37,11 @@ class RulesShippingFrameworkJoomla extends RulesShippingFramework {
                //          ...);
                JPluginHelper::importPlugin('vmshipmentrules');
                $dispatcher = JDispatcher::getInstance();
-               $custfuncdefs = call_user_func_array('array_merge', $dispatcher->trigger('onVmShippingRulesRegisterCustomFunctions',array()));
+               $defs = $dispatcher->trigger('onVmShippingRulesRegisterCustomFunctions',array());
+               $custfuncdefs = array();
+               if (!empty($defs)) {
+                       $custfuncdefs = call_user_func_array('array_merge', $defs);
+               }
                $custfuncdefs['convertfromcurrency'] = array($this, 'convert_from_currency');
                $custfuncdefs['converttocurrency'] = array($this, 'convert_to_currency');

If you are not familiar with how a diff works (it is a markup of changed lines...), simply open the file rules_shipping_framework_joomla.php, look for the line
               $custfuncdefs = call_user_func_array('array_merge', $dispatcher->trigger('onVmShippingRulesRegisterCustomFunctions',array()));
and replace it with:
               $defs = $dispatcher->trigger('onVmShippingRulesRegisterCustomFunctions',array());
               $custfuncdefs = array();
               if (!empty($defs)) {
                       $custfuncdefs = call_user_func_array('array_merge', $defs);
               }

Best regards,
Reinhold
The administrator has disabled public write access.

Warning: array_merge() expects at least 1 paramete 19 Jun 2017 08:55 #3

Thank you
The administrator has disabled public write access.

[SOLVED] Warning: array_merge() expects at least 1 paramete 19 Jun 2017 08:55 #4

Problem solved.
The administrator has disabled public write access.

VM - Shopping cart

 x 

Cart empty

Login Formular