CherryFramework icon indicating copy to clipboard operation
CherryFramework copied to clipboard

PHP 8 Error Fix

Open Erictoby opened this issue 5 years ago • 14 comments

CherryFramework works with PHP 8 with a few modifications at Wordpress 5.6 in my case.

(1) /wordpress/wp-content/themes/CherryFramework/includes/lessc.inc.php (convert {} to []) Line 657 to: $subProp[1][0] != $this->vPrefix) Line 1624 to : if ($name[0] != '@') $name = '@'.$name; Line 2281 to: if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) { Line 2335 to: if ($tag[0] == $this->lessc->vPrefix) Line 3065 to: } elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') {

(2) /wordpress/wp-content/plugins/cherry-plugin/includes/plugin-assets.php Line 108 from: $https = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; -> Line 108 to: $https = empty($_SERVER["HTTPS"]) ? '' : (($_SERVER["HTTPS"] == "on") ? "s" : "");

Erictoby avatar Feb 22 '21 15:02 Erictoby

CherryFramework works with PHP 8 with a few modifications at Wordpress 5.6 in my case.

(1) /wordpress/wp-content/themes/CherryFramework/includes/lessc.inc.php (convert {} to []) Line 657 to: $subProp[1][0] != $this->vPrefix) Line 1624 to : if ($name[0] != '@') $name = '@'.$name; Line 2281 to: if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) { Line 2335 to: if ($tag[0] == $this->lessc->vPrefix) Line 3065 to: } elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') {

(2) /wordpress/wp-content/plugins/cherry-plugin/includes/plugin-assets.php Line 108 from: $https = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; -> Line 108 to: $https = empty($_SERVER["HTTPS"]) ? '' : (($_SERVER["HTTPS"] == "on") ? "s" : "");

Does this fix work for CherryFramework 3 or 4?

nulurker avatar Feb 23 '21 00:02 nulurker

+1 - will this get fixed for PHP 8.x?

ryanrca avatar Nov 10 '22 01:11 ryanrca

Hi.

I'm facing an error with Cherry Mega Menu (v1.0.4) after moving to PHP 8.1.13 with WP 6.1.1:

Line 24: /wp-content/plugins/cherry-mega-menu/admin/includes/class-cherry-update/class-cherry-plugin-update.php

Uncaught Error: Undefined constant "CHERRY_UPDATE" in /wp-content/plugins/cherry-mega-menu/admin/includes/class-cherry-update/class-cherry-plugin-update.php:24 Stack trace: #0 /wp-content/plugins/cherry-mega-menu/admin/includes/class-cherry-update/class-cherry-plugin-update.php(24): constant() #1 /wp-content/plugins/cherry-mega-menu/cherry-mega-menu.php(188): Cherry_Plugin_Update->init() #2 /wp-content/plugins/cherry-mega-menu/cherry-mega-menu.php(68): cherry_mega_menu->_admin() #3 /wp-content/plugins/cherry-mega-menu/cherry-mega-menu.php(251): cherry_mega_menu->__construct() #4 /wp-settings.php(447): include_once('...') #5 /wp-config.php(79): require_once('...') #6 /wp-load.php(50): require_once('...') #7 /wp-admin/admin.php(34): require_once('...') #8 /wp-admin/index.php(10): require_once('...') #9 {main} thrown

Any idea or fix for that?

malo1976 avatar Dec 20 '22 12:12 malo1976

I have the same issue ^

grzybniak avatar Jan 09 '23 11:01 grzybniak

I'm very desperate, my customers won't reach me for the next few weeks. I've followed the hints above but it doesn't work.

WordPress-Version 6.0.3 Aktives Theme: theme51348 (Version 2.2.2) Aktuelles Plugin: (Version ) PHP-Version 8.1.14

templatemonster told me that cherry framework will not update to php 8 and my provider will no longer offers php 7

Please, Please I urgently need help

Jagdschule avatar Feb 03 '23 16:02 Jagdschule

I have to keep my client stuck on PHP V7.4 until Cherry Framework if it gets to supporting PHP 8.X,

This is a great solution, though, until it sent the same (or similar) error that @malo1976 presented.

thesocialdiner avatar Feb 21 '23 23:02 thesocialdiner

I found a temporary workaround to the error: Uncaught Error: Undefined constant "CHERRY_UPDATE" in /wp-content/plugins/cherry-mega-menu/admin/includes/class-cherry-update/class-cherry-plugin-update.php:24

Basically the error is just saying that a variable CHERRY_UPDATE isn't defined. I checked the code, and it looks like it's expecting a boolean. So add the following to the very top of the file /wp-content/plugins/cherry-mega-menu/admin/includes/class-cherry-update/class-cherry-plugin-update.php (But not in a comment area)

define('CHERRY_UPDATE', false);

That worked for me!

chrisringrose avatar Mar 20 '23 23:03 chrisringrose

ive applied these fixes but am still getting Fatal Error from the functions.php file:

pHP Fatal error: Uncaught Error: Call to undefined function create_function() in /home/USERNAME/public_html/wp/wp-content/themes/CherryFramework/functions.php:272

THE LINE IS:

add_filter('login_errors',create_function('$a', "return null;"));

What needs tio be changed to fix this one?

theozsnowman avatar Jun 13 '23 23:06 theozsnowman

add_filter('login_errors',create_function('$a', "return null;"));

create_function is deprecated. So, you may try like this;

add_filter('login_errors', function($a){ return null; });

Erictoby avatar Jun 13 '23 23:06 Erictoby

add_filter('login_errors',create_function('$a', "return null;"));

create_function is deprecated. So, you may try like this;

add_filter('login_errors', function($a){ return null; });

cheers that sorted it out...

only issue i cant figure out now is

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function WP_Widget::__construct(), 0 passed in /home/website/public_html/wp/wp-includes/class-wp-widget-factory.php on line 62 and at least 2 expected in /home/website/public_html/wp/wp-includes/class-wp-widget.php:163

seems lik its caused by the cherry-plugin:

/home/website/public_html/wp/wp-content/plugins/cherry-plugin/includes/widgets/register-widgets.php(26): register_widget('MY_PostWidget')

theozsnowman avatar Jul 31 '23 00:07 theozsnowman

Hi, I've faced the same issues, and simply commented line 26 of the file (register_widget...). This function is supposed to accept a name, but may be now it is no more possible. My website is back to normal now, even though I will not touch it anymore. At least no PHP error, only warnings, with PHP 8.4. Hope this helps.

TeletcheaLab avatar Sep 15 '23 00:09 TeletcheaLab

Thx I will try to check this soon

grzybniak avatar Sep 16 '23 06:09 grzybniak