Error when importing on PHP 8.0+ #5049

Closed
opened 2026-02-20 16:28:45 -05:00 by deekerman · 0 comments
Owner

Originally created by @JackBuchanan on GitHub (Aug 2, 2023).

Issue

When importing records while running PHP 8.0 the Step 2 page fails to load giving the error:
[02-Aug-2023 09:49:07 UTC] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /var/www/SuiteCRMCorePR/modules/Import/views/view.confirm.php:416
Stack trace:
#0 /var/www/SuiteCRMCorePR/modules/Import/views/view.confirm.php(208): ImportViewConfirm->getMaxColumnsInSampleSet()
#1 /var/www/SuiteCRMCorePR/include/MVC/View/SugarView.php(210): ImportViewConfirm->display()
#2 /var/www/SuiteCRMCorePR/include/MVC/Controller/SugarController.php(432): SugarView->process()
#3 /var/www/SuiteCRMCorePR/include/MVC/Controller/SugarController.php(363): SugarController->processView()
#4 /var/www/SuiteCRMCorePR/include/MVC/SugarApplication.php(101): SugarController->execute()
#5 /var/www/SuiteCRMCorePR/index.php(52): SugarApplication->execute()
#6 {main}
thrown in /var/www/SuiteCRMCorePR/modules/Import/views/view.confirm.php on line 416

Expected Behavior

Import step 2 should display with no issues

Actual Behavior

Import page 2 displays a blank screen as a fatal has been thrown

Possible Fix

Add check that value is an array before counting

Steps to Reproduce

  1. Create a task record
  2. Export the task record
  3. Import task record
  4. See step 2 page fails to load

Context

Impacts users attempting to import records

Your Environment

  • SuiteCRM Version used:
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome
  • Environment name and version (e.g. MySQL, PHP 7): MySQL PHP 8.0
  • Operating System and version (e.g Ubuntu 16.04): 18.04
Originally created by @JackBuchanan on GitHub (Aug 2, 2023). <!--- Provide a general summary of the issue in the **Title** above --> <!--- Before you open an issue, please check if a similar issue already exists or has been closed before. ---> <!--- If you have discovered a security risk please report it by emailing security@suitecrm.com. This will be delivered to the product team who handle security issues. Please don't disclose security bugs publicly until they have been handled by the security team. ---> <!--- Please be aware that as of the 31st January 2022 we no longer support 7.10.x. New issues referring to 7.10.x will only be valid if applicable to 7.12.x and above. If your issue is still applicable in 7.12.x, please create the issue following the template below --> #### Issue When importing records while running PHP 8.0 the Step 2 page fails to load giving the error: [02-Aug-2023 09:49:07 UTC] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /var/www/SuiteCRMCorePR/modules/Import/views/view.confirm.php:416 Stack trace: #0 /var/www/SuiteCRMCorePR/modules/Import/views/view.confirm.php(208): ImportViewConfirm->getMaxColumnsInSampleSet() #1 /var/www/SuiteCRMCorePR/include/MVC/View/SugarView.php(210): ImportViewConfirm->display() #2 /var/www/SuiteCRMCorePR/include/MVC/Controller/SugarController.php(432): SugarView->process() #3 /var/www/SuiteCRMCorePR/include/MVC/Controller/SugarController.php(363): SugarController->processView() #4 /var/www/SuiteCRMCorePR/include/MVC/SugarApplication.php(101): SugarController->execute() #5 /var/www/SuiteCRMCorePR/index.php(52): SugarApplication->execute() #6 {main} thrown in /var/www/SuiteCRMCorePR/modules/Import/views/view.confirm.php on line 416 <!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug --> <!--- Ensure that all code ``` is surrounded ``` by triple back quotes. This can also be done over multiple lines --> #### Expected Behavior Import step 2 should display with no issues <!--- Tell us what should happen --> #### Actual Behavior Import page 2 displays a blank screen as a fatal has been thrown <!--- Tell us what happens instead --> <!--- Also please check relevant logs (suitecrm.log, php error.log etc.) --> #### Possible Fix Add check that value is an array before counting <!--- Not obligatory, but suggest a fix or reason for the bug --> #### Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug include code to reproduce, if relevant --> 1. Create a task record 2. Export the task record 3. Import task record 4. See step 2 page fails to load #### Context Impacts users attempting to import records <!--- How has this bug affected you? What were you trying to accomplish? --> <!--- If you feel this should be a low/medium/high priority then please state so --> #### Your Environment <!--- Include as many relevant details about the environment you experienced the bug in --> * SuiteCRM Version used: * Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome * Environment name and version (e.g. MySQL, PHP 7): MySQL PHP 8.0 * Operating System and version (e.g Ubuntu 16.04): 18.04
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#5049
No description provided.