gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.04k stars 204 forks source link

PHP 8+ / Joomla 4 / Gantry 5: trim(): Passing null to parameter #1 ($string) of type string is deprecated. #3130

Open osnodegeoffrey opened 1 year ago

osnodegeoffrey commented 1 year ago

Tried with multiple version of PHP 8+ Gantry 5.5.15 Joomla 4.2.9 template: Hydrogen

When navigating to the theme styles editor, we get the following error:

500 Internal Server Error
Oops, Failed to read cookie-consent-neo.yaml: trim(): Passing null to parameter #1 ($string) of type string is deprecated.

and multiple exception in the front end.

This happens after installing a new particle (cookie consent neo).

Everything works fine if we install it and configure with PHP 7.4 then run it with PHP 8+ after but it seems to not be able to load from the yaml file to show the configuration window.

This seems to be coming from https://github.com/rockettheme/toolbox/blob/develop/Compat/src/Yaml/Inline.php#L48

Stack trace:

|Function|Location

-- | -- | -- 1 | () | JROOT/libraries/gantry5/vendor/rockettheme/toolbox/Compat/src/Yaml/Inline.php:48 2 | Whoops\Run->handleError() | JROOT/libraries/gantry5/src/classes/Gantry/Component/Whoops/SystemFacade.php:119 3 | Gantry\Component\Whoops\SystemFacade->handleError() |   4 | trim() | JROOT/libraries/gantry5/vendor/rockettheme/toolbox/Compat/src/Yaml/Inline.php:48 5 | RocketTheme\Toolbox\Compat\Yaml\Inline::parse() | JROOT/libraries/gantry5/vendor/rockettheme/toolbox/Compat/src/Yaml/Parser.php:169 6 | RocketTheme\Toolbox\Compat\Yaml\Parser->doParse() | JROOT/libraries/gantry5/vendor/rockettheme/toolbox/Compat/src/Yaml/Parser.php:78 7 | RocketTheme\Toolbox\Compat\Yaml\Parser->parse() | JROOT/libraries/gantry5/vendor/rockettheme/toolbox/Compat/src/Yaml/Yaml.php:65 8 | RocketTheme\Toolbox\Compat\Yaml\Yaml::parse() | JROOT/libraries/gantry5/vendor/rockettheme/toolbox/File/src/YamlFile.php:154 9 | RocketTheme\Toolbox\File\YamlFile->decode() | JROOT/libraries/gantry5/src/classes/Gantry/Component/File/CompiledFile.php:101 10 | Gantry\Component\File\CompiledYamlFile->content() | JROOT/libraries/gantry5/src/classes/Gantry/Admin/Particles.php:84 11 | Gantry\Admin\Particles->all() | JROOT/libraries/gantry5/src/classes/Gantry/Admin/Controller/Html/Configurations/Layout.php:509 12 | Gantry\Admin\Controller\Html\Configurations\Layout->getParticles() | JROOT/libraries/gantry5/src/classes/Gantry/Admin/Controller/Html/Configurations/Layout.php:106 13 | Gantry\Admin\Controller\Html\Configurations\Layout->index() |   14 | call_user_func_array() | JROOT/libraries/gantry5/src/classes/Gantry/Component/Controller/BaseController.php:92 15 | Gantry\Component\Controller\BaseController->execute() | JROOT/libraries/gantry5/src/classes/Gantry/Component/Controller/HtmlController.php:37 16 | Gantry\Component\Controller\HtmlController->execute() | JROOT/libraries/gantry5/src/classes/Gantry/Admin/Controller/Html/Configurations.php:282 17 | Gantry\Admin\Controller\Html\Configurations->executeForward() | JROOT/libraries/gantry5/src/classes/Gantry/Admin/Controller/Html/Configurations.php:261 18 | Gantry\Admin\Controller\Html\Configurations->forward() |   19 | call_user_func_array() | JROOT/libraries/gantry5/src/classes/Gantry/Component/Controller/BaseController.php:92 20 | Gantry\Component\Controller\BaseController->execute() | JROOT/libraries/gantry5/src/classes/Gantry/Component/Controller/HtmlController.php:37 21 | Gantry\Component\Controller\HtmlController->execute() | JROOT/libraries/gantry5/src/classes/Gantry/Component/Router/Router.php:115 22 | Gantry\Component\Router\Router->execute() | JROOT/libraries/gantry5/src/classes/Gantry/Component/Router/Router.php:69 23 | Gantry\Component\Router\Router->dispatch() | JROOT/administrator/components/com_gantry5/gantry5.php:67 24 | require_once() | JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71 25 | Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher{closure}() | JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73 26 | Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() | JROOT/libraries/src/Component/ComponentHelper.php:355 27 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT/libraries/src/Application/AdministratorApplication.php:143 28 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT/libraries/src/Application/AdministratorApplication.php:186 29 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT/libraries/src/Application/CMSApplication.php:294 30 | Joomla\CMS\Application\CMSApplication->execute() | JROOT/administrator/includes/app.php:61 31 | require_once() | JROOT/administrator/index.php:32

osnodegeoffrey commented 1 year ago

I have created https://github.com/rockettheme/toolbox/pull/36 that solve the issue on my server at least