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.

By gregThomas - February 26, 2020

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 gregThomas - April 15, 2020

Hey Dan,

Thanks for letting us know about this one. The HTML purifier library that CMS Builder uses has three instances were it uses curly braces which are depreciated in version 7.4 of PHP. I've upgraded CMS Builder to use the latest version of the library, so this issue will be resolved in the next release. 

You can manually patch your version of CMS Builder as follows:

  1. Make a backup of your current CMS builder directory
  2. Download the zip file attached to this post with the latest version of the HTML purifier library.
  3. Navigate to your cmsb/3rdparty/HTMLPurifier directory and overwrite it with the all contents of the directory htmlpurifier-4.12.0-standalone in the zip file.
    1. Both directories should contain a file called HTMLPurifier.standalone.php and a subdirectory called standalone (see attached screenshot for example).

If you'd prefer, I can provide you with line by line instructions to update the current version of the HTML purifier library instead. 

Greg Thomas







PHP Programmer - interactivetools.com

By depdesign - April 15, 2020

Hi Greg,

Thanks for the rapid response!  The update worked!

Dan

Dan Perez