- Posts: 646
- Thank you received: 26
PDF invoice plugin 5.2.21: "Call to a member function get() on null" on HikaShop
2 weeks 6 days ago #100000709
by Lumiga
Kind regards,
Lumiga
PDF invoice plugin 5.2.21: "Call to a member function get() on null" on HikaShop was created by Lumiga
-- HikaShop version -- : 6.8.2
-- Joomla version -- : 6.2.1
-- Browser(s) name and version -- : Chrome 156.0
-- Error-message(debug-mod must be tuned on) -- : Call to a member function get() on null
JROOT/plugins/hikashop/attachinvoice/attachinvoice.php:59
plgHikashopAttachinvoice->__construct() - hikashop_import() administrator/components/com_hikashop/helpers/helper.php:757 listing() administrator/components/com_hikashop/views/plugins/view.html.php:147
Dear HikaShop team,
After updating to PDF invoice plugin 5.2.21, opening HikaShop > System > Plugins gives a fatal error:
Call to a member function get() on null
JROOT/plugins/hikashop/attachinvoice/attachinvoice.php:59
plgHikashopAttachinvoice->__construct()
<- hikashop_import() administrator/components/com_hikashop/helpers/helper.php:757
<- PluginsViewPlugins->listing() administrator/components/com_hikashop/views/plugins/view.html.php:147
Cause:
Line 59 in the constructor reads the plugin parameters:
self::$zeroVatSupply = (string)$this->params->get('zero_vat_supply', 'services');
When the plugin is instantiated through hikashop_import() on the plugins listing, no params are passed to the constructor, so $this->params is null and the page crashes.
Fix (tested on our site):
self::$zeroVatSupply = $this->params ? (string)$this->params->get('zero_vat_supply', 'services') : 'services';
With this null check the plugins page opens normally again. Could you include this fix in the next release, so it isn't lost when we update the plugin?
Kind regards,
Lumiga
-- Joomla version -- : 6.2.1
-- Browser(s) name and version -- : Chrome 156.0
-- Error-message(debug-mod must be tuned on) -- : Call to a member function get() on null
JROOT/plugins/hikashop/attachinvoice/attachinvoice.php:59
plgHikashopAttachinvoice->__construct() - hikashop_import() administrator/components/com_hikashop/helpers/helper.php:757 listing() administrator/components/com_hikashop/views/plugins/view.html.php:147
Dear HikaShop team,
After updating to PDF invoice plugin 5.2.21, opening HikaShop > System > Plugins gives a fatal error:
Call to a member function get() on null
JROOT/plugins/hikashop/attachinvoice/attachinvoice.php:59
plgHikashopAttachinvoice->__construct()
<- hikashop_import() administrator/components/com_hikashop/helpers/helper.php:757
<- PluginsViewPlugins->listing() administrator/components/com_hikashop/views/plugins/view.html.php:147
Cause:
Line 59 in the constructor reads the plugin parameters:
self::$zeroVatSupply = (string)$this->params->get('zero_vat_supply', 'services');
When the plugin is instantiated through hikashop_import() on the plugins listing, no params are passed to the constructor, so $this->params is null and the page crashes.
Fix (tested on our site):
self::$zeroVatSupply = $this->params ? (string)$this->params->get('zero_vat_supply', 'services') : 'services';
With this null check the plugins page opens normally again. Could you include this fix in the next release, so it isn't lost when we update the plugin?
Kind regards,
Lumiga
Kind regards,
Lumiga
Please Log in or Create an account to join the conversation.
2 weeks 6 days ago #100000713
by nicolas
Replied by nicolas on topic PDF invoice plugin 5.2.21: "Call to a member function get() on null" on HikaShop
Hi,
Thank you for the detailed report and the fix. You are right: since version 5.2.21 the plugin reads its "Sales without VAT abroad" setting when it is created, and the plugins listing of HikaShop creates it without its settings, hence the error.
This is fixed in version 5.2.23 of the PDF invoice plugin, available now: Joomla's updater shows it, or you can download it from your account on our website, and install it over your current version (your settings are kept). Rather than only checking for missing settings, it loads the plugin's own settings in that case, so the plugin keeps your "Sales without VAT abroad" choice wherever it is loaded. You can install it over your patched file.
Thank you for the detailed report and the fix. You are right: since version 5.2.21 the plugin reads its "Sales without VAT abroad" setting when it is created, and the plugins listing of HikaShop creates it without its settings, hence the error.
This is fixed in version 5.2.23 of the PDF invoice plugin, available now: Joomla's updater shows it, or you can download it from your account on our website, and install it over your current version (your settings are kept). Rather than only checking for missing settings, it loads the plugin's own settings in that case, so the plugin keeps your "Sales without VAT abroad" choice wherever it is loaded. You can install it over your patched file.
The following user(s) said Thank You: Lumiga
Please Log in or Create an account to join the conversation.
Time to create page: 0.042 seconds