PHP v8

22 posts by 6 authors in: Forums > CMS Builder
Last Post: November 10, 2021   (RSS)

By Steve99 - October 15, 2021 - edited: October 15, 2021

Hi Dave,

I'm testing the beta CMS Builder v3.55 (Build 2295) and wanted to report a bug. On a multi-record section editor, the Advanced Commands don't work if per page is set to 1000.

Also have a question. I found the setting to automatically convert uploads to WebP format. Is there a method to convert existing uploads to WebP format?

Best,
Steve

By mark99 - October 18, 2021 - edited: October 18, 2021

I'm not currently able to test if I have the same issue as Steve, above.

But otherwise, I've tested across my beta install and also put it on my live site, both on PHP7.4 and PHP8, and so far it appears to be working without any problems. I'll continue to test to see if I can spot any problems.

By Deborah - October 18, 2021 - edited: October 18, 2021

[Edited after initial post.]

I'm still testing the beta, but ran into an issue.

Using either PHP 7.4 or PHP 8.0, when attempting to access the "General Settings" page, this error results:
"Call to undefined function shell_exec() in /home/test/public_html/cmsbeta/lib/menus/admin/actionHandler.php on line 598."

I didn't see this right away in 7.4, but am now.

If I switch to PHP 7.4 this does't happen.

'shell_exec' is not disabled in the server's php.ini for PHP 8.0, however it is disabled in 7.4 and doesn't present a problem.

'shell_exec' is not disabled in either PHP version.

~ Deborah

By Dave - October 18, 2021

Hi Steve, 

I'm testing the beta CMS Builder v3.55 (Build 2295) and wanted to report a bug. On a multi-record section editor, the Advanced Commands don't work if per page is set to 1000.

Do none of the options work? Even "Admin: Code Generator"? If so, my first guess is that it's because the generated URL is too long and it's being rejected by the server.

Also have a question. I found the setting to automatically convert uploads to WebP format. Is there a method to convert existing uploads to WebP format?

Yes, we have an internal plugin for that and we're working to integrate into the main codebase.

Let me know any other questions or issues you find.  Thanks!

Dave Edis - Senior Developer
interactivetools.com

By Dave - October 18, 2021

Hi Deborah, 

UsingeitherPHP 7.4 or PHP 8.0, when attempting to access the "General Settings" page, this error results:
"Call to undefined function shell_exec() in /home/test/public_html/cmsbeta/lib/menus/admin/actionHandler.php on line 598."

This likely indicates that shell_exec is being disabled somewhere in the server setup.  Can you save a script test_shell_exec.php in the same folder as cmsb/admin.php and let me know what the output is? 

<?php 
  // test_shell_exec.php

  error_reporting(-1);
  ini_set('display_errors', '1');
  ini_set('display_startup_errors', '1');
  
  echo shell_exec('pwd 2>&1');
  
  exit;
?>

Let me know what it shows.  I'll also work on a patch so even if that function is unavailable the general settings menu is still functional.

Thanks!

Dave Edis - Senior Developer
interactivetools.com

By mark99 - October 18, 2021

Found a bug in the official twitter plugin with PHP8. When somebody attempts to login:

#27 - UNCAUGHT_EXCEPTION: Call to undefined function create_function()
/.../system/plugins/twitterLogin/twitterLogin.php (line 178)
https://www..../sign-up.php?action=twitterLoginStart

By Steve99 - October 19, 2021

Hi Dave, 

I'm testing the beta CMS Builder v3.55 (Build 2295) and wanted to report a bug. On a multi-record section editor, the Advanced Commands don't work if per page is set to 1000.

Do none of the options work? Even "Admin: Code Generator"? If so, my first guess is that it's because the generated URL is too long and it's being rejected by the server.

Correct.
Apparently I hadn't previously attempted an Advanced Command while having a per page of 1000, as I can replicate this with previous builds. ¯\_(ツ)_/¯
Is the CMS creating a URL "behind the scenes" for processing that contains all record nums or something that gets passed through any Advanced Command?

Also have a question. I found the setting to automatically convert uploads to WebP format. Is there a method to convert existing uploads to WebP format?

Yes, we have an internal plugin for that and we're working to integrate into the main codebase.

Awesome, thanks for the info!

---------------------------------------------

On a separate note, I've discovered a PHP 8 compatibility issue when testing the CSV Export plugin with this beta installation.
"Cannot access offset of type string on string /plugins/csvExport/csvExport.php (line 101)"

I poked around a bit and it seems the last loop contains just a string of the table name.

Adding either of the following at the start of the loop appears to resolve the issue:

if (!is_array(@$schema[$name])) { continue; } // skip if not array

- or -

if (@$schema[$name] == $tableName) { continue; } // skip if schema name equals table name

before:

if (@$schema[$name]['type'] != 'upload') { continue; } // skip all but upload fields

You may come up with a completely different solution, but just wanted to pass along the info. :)
(Normally I'd keep a plugin reference in its separate designated forum space, so I hope you don't mind since we were already discussing PHP 8 here.)

Best,
Steve

By Deborah - October 19, 2021

Hi, Dave.

Here's the test_shell_exec.php results with PHP 8:

Fatal error: Uncaught Error: Call to undefined function shell_exec() in /home/test/public_html/_cmsbeta355/test_shell_exec.php:8 Stack trace: #0 {main} thrown in /home/test/public_html/_cmsbeta355/test_shell_exec.php on line 8

I have 'shell_exec' disabled for the server, but enabled at the account/domain level and it does not appear in the php.info disabled list.

It appears PHP 7.4 may not be showing this error after all - just 8. (I may have not restarted PHP-FPM yesterday.)

In CMSB versions up to 3.53 I've always have had 'shell_exec' disabled, so I'm guessing there must be a change in the current beta.

Happy to provide server access if it would be of any help.

~ Deborah

By Michael - October 21, 2021

Try replacing those lines with the following:

$keyEqualsValue             = function($k, $v) { return $k.'='.$v; };       // key=value
$keyEqualsDoubleQuotedValue = function($k, $v) { return $k.'="'.$v.'"'; };  // key="value"
Michael Sams
Programmer
interactivetools.com