Import error array_change_key_case(): Argument #1 ($array) must be of type array

  • Posts: 1089
  • Thank you received: 12
  • Hikashop Business
1 month 13 hours ago #366125

-- HikaShop version -- : 5.1.5
-- Joomla version -- : 5.2.3
-- PHP version -- : 8.3

Hello!
I created a csv to import and I get
array_change_key_case(): Argument #1 ($array) must be of type array, false given

Can you help please?

Attachments:

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

  • Posts: 1089
  • Thank you received: 12
  • Hikashop Business
1 month 12 hours ago #366126

I just saw these php warnings
Do you think they are related?

[06-Mar-2025 10:08:40 UTC] PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /home/php8/public_html/milonopoulos-carpets.gr/plugins/hikashoppayment/platron/PG_Signature.php on line 17
[11-Mar-2025 17:27:01 UTC] PHP Warning: file_get_contents( b2b.carpet.gr/photos_xml/--1.jpg ): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/php8/public_html/milonopoulos-carpets.gr/administrator/components/com_hikashop/helpers/import.php on line 813
[11-Mar-2025 17:27:01 UTC] PHP Warning: file_get_contents( b2b.carpet.gr/photos_xml/--1.jpg ): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/php8/public_html/milonopoulos-carpets.gr/administrator/components/com_hikashop/helpers/import.php on line 820
[11-Mar-2025 17:27:02 UTC] PHP Warning: file_get_contents( b2b.carpet.gr/photos_xml/16KOFW--1.jpg ): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/php8/public_html/milonopoulos-carpets.gr/administrator/components/com_hikashop/helpers/import.php on line 813
[11-Mar-2025 17:27:02 UTC] PHP Warning: file_get_contents( b2b.carpet.gr/photos_xml/16KOFW--1.jpg ): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/php8/public_html/milonopoulos-carpets.gr/administrator/components/com_hikashop/helpers/import.php on line 820
[11-Mar-2025 17:27:04 UTC] PHP Warning: file_get_contents( b2b.carpet.gr/photos_xml/16F213X--1.jpg ): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/php8/public_html/milonopoulos-carpets.gr/administrator/components/com_hikashop/helpers/import.php on line 813
[11-Mar-2025 17:27:05 UTC] PHP Warning: file_get_contents( b2b.carpet.gr/photos_xml/11LIN7400BAG--1.jpg ): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/php8/public_html/milonopoulos-carpets.gr/administrator/components/com_hikashop/helpers/import.php on line 813

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

  • Posts: 83590
  • Thank you received: 13528
  • MODERATOR
1 month 9 hours ago #366129

Hi,

These warnings are indeed linked.
Because the import is not able to access the URL of the images you have in your CSV, and because you're on PHP 8.3, PHP is more strict with the call to array_change_key_case and stops the process with that error instead of just rolling with it and just skipping the file with a warning.

I've just added a patch on our end to remove the error. So you can update your HikaShop to get the patch. But it might be better to just add the missing images or fix the URLs in the CSV file so that the proper data is imported.

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

  • Posts: 1089
  • Thank you received: 12
  • Hikashop Business
1 week 22 hours ago #366524

Good morning!
I installed the patched version and tried again with no luck.
I cleaned error log and tried to upload 5 products but failed again.

My csv is

product_id;product_parent_id;product_name;product_description;product_quantity;product_code;product_published;product_hit;product_created;product_sale_start;product_sale_end;product_delay_id;product_tax_id;product_type;product_vendor_id;product_manufacturer_id;product_url;product_weight;product_keywords;product_weight_unit;product_modified;product_meta_description;product_dimension_unit;product_width;product_length;product_height;product_max_per_order;product_access;product_group_after_purchase;product_min_per_order;product_contact;product_display_quantity_field;product_last_seen_date;product_sales;product_waitlist;product_layout;product_average_score;product_total_vote;product_page_title;product_alias;product_price_percentage;product_msrp;product_canonical;product_warehouse_id;product_quantity_layout;product_sort_price;product_description_raw;product_description_type;product_option_method;product_condition;dimension;color;series;material;categories_ordering;parent_category;categories_image;categories;price_value;price_currency_id;price_min_quantity;price_access;price_users;files;images
7158;0;Κλασικό Χαλί Olympia Classic 5238B RED Royal Carpet - 140 x 200 cm;Τα Olympia είναι οικονομικά ακρυλικά χαλιά σε κλασικά σχέδια και κλασικές αποχρώσεις και διατίθενται σε μια πολύ μεγάλη γκάμα σχεδίων και διαστάσεων;3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100% heatset;;;;18;87;;;;;; b2b.carpet.gr/photos_xml/11OLY5238BRE--1.jpg
7159;0;Κλασικό Χαλί Olympia Classic 5238B RED Royal Carpet - 160 x 230 cm;Τα Olympia είναι οικονομικά ακρυλικά χαλιά σε κλασικά σχέδια και κλασικές αποχρώσεις και διατίθενται σε μια πολύ μεγάλη γκάμα σχεδίων και διαστάσεων;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100% heatset;;;;18;114;;;;;; b2b.carpet.gr/photos_xml/11OLY5238BRE--1.jpg
7160;0;Κλασικό Χαλί Olympia Classic 5238B RED Royal Carpet - 200 x 250 cm;Τα Olympia είναι οικονομικά ακρυλικά χαλιά σε κλασικά σχέδια και κλασικές αποχρώσεις και διατίθενται σε μια πολύ μεγάλη γκάμα σχεδίων και διαστάσεων;11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100% heatset;;;;18;155;;;;;; b2b.carpet.gr/photos_xml/11OLY5238BRE--1.jpg
7161;0;Κλασικό Χαλί Olympia Classic 5238B RED Royal Carpet - 200 x 300 cm;Τα Olympia είναι οικονομικά ακρυλικά χαλιά σε κλασικά σχέδια και κλασικές αποχρώσεις και διατίθενται σε μια πολύ μεγάλη γκάμα σχεδίων και διαστάσεων;2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100% heatset;;;;18;186;;;;;; b2b.carpet.gr/photos_xml/11OLY5238BRE--1.jpg





Thank you

Attachments:

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

  • Posts: 83590
  • Thank you received: 13528
  • MODERATOR
1 week 19 hours ago #366525

Hi,

I don't see the same error message in your zip.
There, I see error messages like this:

PHP Warning: get_headers(http://***********.jpg): Failed to open stream: Connection timed out

As I said, the fix I added is only to prevent the

array_change_key_case(): Argument #1 ($array) must be of type array, false given

error, not the warnings.
We want to keep the warnings so that users know why the images can't be loaded.
Looking into it again today, I see that at least some of the images in your CSV are valid (I can open them with my browser).
So, the issue probably comes from the configuration of your server, not allowing your PHP to access the URLs. It can for example be the "allow_url_fopen" parameter of the php.ini which is turned off.
To circumvent the problem, you can upload the images in the images/com_hikashop/upload folder via FTP. That's where HikaShop stores the images. Then, in your CSV, instead of having the URL of the image, you can just use its filename so that the import can link the product with the image already in the upload folder. The import will be much faster (useful if you have a lot of products to import), and it will circumvent the issue with your server configuration preventing your PHP from accessing the files.

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

  • Posts: 1089
  • Thank you received: 12
  • Hikashop Business
1 week 18 hours ago #366527

Last month I uploaded another csv in batches, almost 3000 products with no problem. And images got in.
So it must be something else.

I ll try with no image at all 1 product to test

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

  • Posts: 83590
  • Thank you received: 13528
  • MODERATOR
1 week 15 hours ago #366528

Hi,

Maybe the configuration of your server changed somehow? Like an update of PHP ? Note that it could also be a security mechanism, like a firewall extension, or a modification of the htaccess, which blocks the download of the images.
Unfortunately, not much HikaShop can do by itself.
If PHP can't download the file of the image with the URL provided, it can't do it, and no PHP code in HikaShop can fix that.
That's why I proposed to circumvent the problem. But if you can figure out what is blocking PHP from accessing the files (maybe your hosting can help with this ?), then it should be easy to correct the problem, allowing PHP, and thus HikaShop, to access the URLs again.

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

Time to create page: 0.073 seconds
Powered by Kunena Forum