PHP 7.4 Errors

6 posts by 3 authors in: Forums > CMS Builder
Last Post: April 15, 2020   (RSS)

By mark99 - February 12, 2020

We just enabled PHP 7.4 and now a lot of CMSB's admincp pages for editing your fields throw up errors like this:

(An unexpected error occurred: #86) (An unexpected error occurred: #87)

In the error log it has these (some details redacted for security).

#87 - E_WARNING: Cannot modify header information - headers already sent by (output started at /../system/lib/errorlog_functions.php:69)
/../system/lib/menus/header.php (line 4)
https://www...../system/admin....php?menu=product&action=edit& ...

#86 - E_DEPRECATED: Array and string offset access syntax with curly braces is deprecated
/../system/lib/menus/default/edit_functions.php (line 794)
https://www...../system/admin.....php?menu=product&action=edit& ...

Looks like you might want to fix that.

Hey Mark,

Thanks for sharing the error log entries, it helped me to track down the issue quickly.

I found the source of the issue, arrays that use curly braces are deprecated in version 7.4 of PHP, and there is a line of code in the function _showCheckbox that uses them. 

I've added a fix to the codebase of CMS Builder so that the issue will be resolved in the next release.

You can manually patch the issue in your version CMS Builder by editing [CMSB Directory]/lib/menus/default/edit_functions.php line 794 and change it from this:

  else if ($record && @$record{$fieldSchema['name']})            { $checkedAttr = 'checked="checked"'; }

to this:

  else if ($record && !empty($record[$fieldSchema['name']]))     { $checkedAttr = 'checked="checked"'; }

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By mark99 - February 26, 2020

Yep that seems to work, thanks Greg.

By depdesign - April 15, 2020

Hi Greg,

This solution also help me within the cms to remove the errors, but, I also see a similar error on the "Simple Forum" now.

This is what I see on the forum:

Deprecated: Array and string offset access syntax with curly braces is deprecated in /cms/cmsAdmin/3rdParty/HTMLPurifier/HTMLPurifier.standalone.php on line 3941 Deprecated: Array and string offset access syntax with curly braces is deprecated in /cms/cmsAdmin/3rdParty/HTMLPurifier/HTMLPurifier.standalone.php on line 14584 Deprecated: Array and string offset access syntax with curly braces is deprecated in /cms/cmsAdmin/3rdParty/HTMLPurifier/HTMLPurifier.standalone.php on line 21109 Deprecated: Array and string offset access syntax with curly braces is deprecated in /cms/cmsAdmin/3rdParty/HTMLPurifier/HTMLPurifier.standalone.php on line 21109

- Dan

Dan Perez
Attachments:

screen-sample.jpg

By depdesign - April 15, 2020

Hi Greg,

Thanks for the rapid response!  The update worked!

Dan

Dan Perez