salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.27k stars 2.03k forks source link

Product import fails with fatal error #10372

Open simonr44 opened 4 months ago

simonr44 commented 4 months ago

Issue

When importing products via CSV file on a server running PHP 8.2 the following error is thrown when reaching the product prices within the import.

PHP Fatal error: Uncaught TypeError: mb_substr(): Argument #3 ($length) must be of type ?int, string given in /var/www/include/utils.php:5149

This is caused by the price vardefs which are in the format 26,4 with 26 representing the overall length and 4 representing the potential decimals.

In PHP8.2 this throws a fatal error and prevents the import from completing.

Expected Behavior

The CSV import process should complete as expected.

Actual Behavior

The import fails with no errors displayed through the UI, just an empty warning box.

Possible Fix

Fix branch to follow

Steps to Reproduce

  1. Prepare an import CSV with the required fields and at least one price
  2. Import the CSV
  3. The import will fail and the 500 fatal error logged

Context

Relatively high priority as it impacts users importing products

Your Environment