How to fix CustomFooter for php 8.1 in magento 2.4.4
Just tested Pearl 1.10.17 in Magento 2.4.4, others bug fixed by myself, but just this issue as below I can't fix.
It showed:
Deprecated Functionality: trim(): Passing null to parameter #1 ($string) of type string is deprecated in \app\code\WeltPixel\CustomFooter\Observer\CustomFooterEditActionControllerSaveObserver.php line 142-146...
I changed the below code
$preFooterBackgroundColor = strlen(trim($preFooterBackgroundColor)) ? 'background-color: ' . $preFooterBackgroundColor . ';': '';
$preFooterTextColor = strlen(trim($preFooterTextColor)) ? 'color: ' . $preFooterTextColor . ';' : '';
$preFooterIconColor = strlen(trim($preFooterIconColor)) ? 'color: ' . $preFooterIconColor . ' !important;' : '';
$footerBackgroundColor = strlen(trim($footerBackgroundColor)) ? 'background-color: ' . $footerBackgroundColor . ';' : '';
$footerTextColor = strlen(trim($footerTextColor)) ? 'color: ' . $footerTextColor . ';' : '';
$footerIconColor = strlen(trim($footerIconColor)) ? 'color: ' . $footerIconColor . ' !important;' : '';
to
$preFooterBackgroundColor = strlen(trim($preFooterBackgroundColor ?? '')) ? 'background-color: ' . $preFooterBackgroundColor . ';': '';
$preFooterTextColor = strlen(trim($preFooterTextColor ?? '')) ? 'color: ' . $preFooterTextColor . ';' : '';
$preFooterIconColor = strlen(trim($preFooterIconColor ?? '')) ? 'color: ' . $preFooterIconColor . ' !important;' : '';
$footerBackgroundColor = strlen(trim($footerBackgroundColor ?? '')) ? 'background-color: ' . $footerBackgroundColor . ';' : '';
$footerTextColor = strlen(trim($footerTextColor ?? '')) ? 'color: ' . $footerTextColor . ';' : '';
$footerIconColor = strlen(trim($footerIconColor ?? '')) ? 'color: ' . $footerIconColor . ' !important;' : '';
the bug won't show, but the footer can't find in Index now...
How to fix this issue?
Thanks very much...
Please sign in to leave a comment.
Comments
1 comment