Deprecated: preg_match in the latest csvImport.php

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 15, 2022   (RSS)

By ht1080z - June 14, 2022


On my local wamp server with PHP 7.4.26 (of course with v8 is the same) I receive inside the cmsBuilder error message: 

Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /mypath/cmsBuilder/plugins/csvImport/csvImport.php on line 119

(I'm using latest version everywhere)

Is this something I can fix easily?


By daniel - June 14, 2022

Hi Karls,

Yes - we have some PHP 8 compatibility updates queued for a number of plugins, CSV Import included. In the meantime, I can give you the changes so that you can patch the plugin and remove the errors.

In csvImport.php

Line 58, change:

ini_set('auto_detect_line_endings', true);


// ini_set('auto_detect_line_endings', true);

Line 119, change:

$onCustomMenu        = preg_match("/^_csv_import_menu_(\d+)$/", @$_REQUEST['menu'], $matches);


$onCustomMenu        = preg_match("/^_csv_import_menu_(\d+)$/", $_REQUEST['menu']??'', $matches);

In csvImport_functions.php 

Line 1697, change:

foreach (explode("\n", $fieldMap) as $line) {


foreach (explode("\n", $fieldMap??'') as $line) {

Let me know if you have any questions, or have any more issues after making these changes!


Technical Lead

By ht1080z - June 15, 2022

Thank you Daniel!