Skip to content

Conversation

@aamirsk8766
Copy link

This PR fixes a potential fatal error that occurs during the import process when $headerColumns is not an array.

In ImportListView.php, the following line:

$this->ss->assign('colCount', count($this->headerColumns));

can throw an error like:

Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given

This usually happens if something goes wrong earlier in the import process and $headerColumns ends up being false or unset.

Motivation and Context
This change ensures that the import view doesn't break if $headerColumns isn’t an array. It's a small defensive coding fix, but it improves stability for users importing large or complex datasets.

How To Test This
Go to the Import section for the Targets module.

Try importing a large or malformed CSV file.

Confirm that the page doesn’t crash with a count() error.

Verify that the number of columns is displayed correctly if $headerColumns is valid.

Types of changes
Bug fix (non-breaking change which fixes an issue)

@mattlorimer mattlorimer added the Type:Suite7 Issue Spefc to SuiteCRM 7 that should be in the SuiteCRM 7 repo label Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type:Suite7 Issue Spefc to SuiteCRM 7 that should be in the SuiteCRM 7 repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants