PHP 8 issues - Deprecated: preg_match()

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 22, 2022   (RSS)

By Deborah - June 17, 2022

Hello.

With CMSB 3.56, when clicking 'Save Details' button in admin of a single-record section editor, the error below appears.
• Does not happen with multi-record section editors.
• Happens with PHP 8.1.5 or 8.1.6, but NOT with PHP 8.0.20 or PHP 7.4.29.

--------------------------------
ERROR:
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/myweb/public_html/cms/lib/menus/database/editTable_functions.php on line 250 Warning: Cannot modify header information - headers already sent by (output started at /home/myweb/public_html/cms/lib/menus/database/editTable_functions.php:250) in /home/myweb/public_html/cms/lib/menus/header.php on line 4
--------------------------------

editTable_functions.php line 250:

$startsWithHttpOrSlash = preg_match("|^(\w+:/)?/|", @$_REQUEST[$name]);

Error looks similar to this post:
https://www.interactivetools.com/forum/forum-posts.php?postNum=2245997#post2245997

I'm not clear on what to edit to compensate for PHP's changes.

Deborah

By Deborah - June 22, 2022 - edited: June 22, 2022

Daniel,

Your fix worked!

I'll take note of your suggestion if I should see that type of warning again.

Thanks so much!
Deborah