[Skip to main content](#vessel-content)

#   PHP Warning: Creating default object from empty value

##

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 431
- Thank you received: 22
-

5 years 10 months ago [\#326950](#326950) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#326950 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")* was created by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")*

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.3.24

This is filing my error log almost every second:
PHP Warning: Creating default object from empty value in administrator/components/com_hikashop/classes/currency.php on line 2505

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

5 years 10 months ago [\#326970](#326970) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#326970 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Hi,

Please try to add the code: Code:

else $payment-&gt;taxes[$tax-&gt;tax_namekey] = new stdClass();

after the code: Code:

if(is_object($tax)) $payment-&gt;taxes[$tax-&gt;tax_namekey] = clone($tax);

in the file administrator/components/com_hikashop/classes/currency.php and it should hopefully fix the warning message.
Please report the result so that we can add the modification for the next version of HikaShop.
That way you won't have to redo the modification after the next update and others won't get the warning in the future.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 431
- Thank you received: 22
-

5 years 10 months ago [\#326980](#326980) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#326980 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Now I have Warning: Creating default object from empty value in administrator/components/com_hikashop/classes/currency.php on line 2507

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

5 years 10 months ago [\#327047](#327047) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#327047 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Mmm. That means we probably don't have the same code on the same line.
Could you edit the file administrator/components/com_hikashop/classes/currency.php on your website and tell me what you have around the line 2507 and which one is the line 2507

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 431
- Thank you received: 22
-

5 years 10 months ago [\#327049](#327049) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#327049 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

From line 2499 to line 2519 Code:

if($payment-&gt;payment_price_with_tax != $payment-&gt;payment_price) { if(!isset($payment-&gt;taxes) &amp;&amp; isset($total-&gt;prices[$k]-&gt;taxes) &amp;&amp; is_array($total-&gt;prices[$k]-&gt;taxes)) { $payment-&gt;taxes = array(); $tax = reset($total-&gt;prices[$k]-&gt;taxes); if(is_object($tax)) $payment-&gt;taxes[$tax-&gt;tax_namekey] = clone($tax); $payment-&gt;taxes[$tax-&gt;namekey]-&gt;tax_amount = $payment-&gt;payment_price_with_tax - $payment-&gt;payment_price; $payment-&gt;taxes[$tax-&gt;namekey]-&gt;amount = $payment-&gt;payment_price; } if(!empty($payment-&gt;taxes)) { foreach($payment-&gt;taxes as $tax) { if(isset($total-&gt;prices[$k]-&gt;taxes[$tax-&gt;tax_namekey])) { $total-&gt;prices[$k]-&gt;taxes[$tax-&gt;tax_namekey]-&gt;tax_amount += $tax-&gt;tax_amount; $total-&gt;prices[$k]-&gt;taxes[$tax-&gt;tax_namekey]-&gt;amount += $tax-&gt;amount; } else $total-&gt;prices[$k]-&gt;taxes[$tax-&gt;tax_namekey] = clone($tax); } } } } }

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

5 years 10 months ago [\#327055](#327055) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#327055 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Hi,

Ok. I think I've found the issue.
Change the code: Code:

if(is_object($tax)) $payment-&gt;taxes[$tax-&gt;tax_namekey] = clone($tax); $payment-&gt;taxes[$tax-&gt;namekey]-&gt;tax_amount = $payment-&gt;payment_price_with_tax - $payment-&gt;payment_price; $payment-&gt;taxes[$tax-&gt;namekey]-&gt;amount = $payment-&gt;payment_price;

to:
Code:

if(is_object($tax) &amp;&amp; !empty($tax-&gt;tax_namekey)) { $payment-&gt;taxes[$tax-&gt;tax_namekey] = clone($tax); $payment-&gt;taxes[$tax-&gt;tax_namekey]-&gt;tax_amount = $payment-&gt;payment_price_with_tax - $payment-&gt;payment_price; $payment-&gt;taxes[$tax-&gt;tax_namekey]-&gt;amount = $payment-&gt;payment_price; }

in there and it should work fine.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 431
- Thank you received: 22
-

5 years 10 months ago [\#327121](#327121) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#327121 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Ok that code solved first problem, but now another
PHP Warning: Invalid argument supplied for foreach() in administrator/components/com_hikashop/classes/cart.php on line 2630

Form line 2629 (after code update) I have Code:

$cart = $this-&gt;get($cart_id); foreach($cart-&gt;cart_products as &amp;$cart_product) { if($cart_product-&gt;cart_product_quantity == 0 &#124;&#124; (is_string($cart_product-&gt;cart_product_id) &amp;&amp; substr($cart_product-&gt;cart_product_id, 0, 1) == 'p')) continue; if(!$this-&gt;compareCartProducts($p, $cart_product, null, $fields)) continue; $p['id'] = (int)$cart_product-&gt;cart_product_id; $cart_products = array($p); return $this-&gt;updateProduct($cart_id, $cart_products); } return $this-&gt;addProduct($cart_id, $data); }

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

5 years 10 months ago [\#327151](#327151) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#327151 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Hi,

Ah yes, a check is missing there.
Change that whole code to: Code:

$cart = $this-&gt;get($cart_id); if(!empty($cart-&gt;cart_products)) { foreach($cart-&gt;cart_products as &amp;$cart_product) { if($cart_product-&gt;cart_product_quantity == 0 &#124;&#124; (is_string($cart_product-&gt;cart_product_id) &amp;&amp; substr($cart_product-&gt;cart_product_id, 0, 1) == 'p')) continue; if(!$this-&gt;compareCartProducts($p, $cart_product, null, $fields)) continue; $p['id'] = (int)$cart_product-&gt;cart_product_id; $cart_products = array($p); return $this-&gt;updateProduct($cart_id, $cart_products); } } return $this-&gt;addProduct($cart_id, $data); }

and it will remove that warning.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 431
- Thank you received: 22
-

5 years 10 months ago [\#327174](#327174) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#327174 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Solved. No warning any more. Thank you.

I have one other, but is about os map plugin.
PHP Warning: Parameter 1 to xmap_com_hikashop::getTree() expected to be a reference, value given in administrator/components/com_osmap/library/alledia/osmap/Helper/General.php on line 396

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

5 years 10 months ago [\#327177](#327177) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#327177 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Hi,

You can edit the file plugins/xmap/com_hikashop/com_hikashop.php and change the line:
function getTree( &amp;$xmap, &amp;$parent, &amp;$params ){
to:
function getTree( $xmap, &amp;$parent, &amp;$params ){
and it should fix the problem.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 431
- Thank you received: 22
-

5 years 10 months ago [\#327356](#327356) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[PHP Warning: Creating default object from empty value](/forum/2-general-talk-about-hikashop/901423-php-warning-creating-default-object-from-empty-value#327356 "-- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.23 -- PHP version -- : 7.3.24  This is filing my error log almost every second: PHP Warning: Creating default object from empty value in administrator/components/com&#95;hikashop/classes/currency.php on line 2505")*

Solved this to.
Thank you nicolas

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzkwMTQyMy1waHAtd2FybmluZy1jcmVhdGluZy1kZWZhdWx0LW9iamVjdC1mcm9tLWVtcHR5LXZhbHVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.176 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
