getgrav / getgrav/grav-plugin-simplesearch

Setting mergeConfig breaks scheduler

Open
#205 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
46
Forks
55
Avg merge
5h 44m
Merged PRs (30d)
1

Description

Just noticed that running the scheduler via `sudo -u www-data -g www-data /usr/bin/php bin/grav scheduler` fails with
```
PHP Fatal error: Uncaught TypeError: Grav\Common\Data\Data::merge(): Argument #1 ($data) must be of type array, Grav\Common\Data\Data given, called in /var/www/html/system/src/Grav/Common/Plugins.php on line 273 and defined in /var/www/html/system/src/Grav/Common/Data/Data.php:203
Stack trace:
#0 /var/www/html/system/src/Grav/Common/Plugins.php(273): Grav\Common\Data\Data->merge()
#1 /var/www/html/system/src/Grav/Common/Plugins.php(231): Grav\Common\Plugins::get()
#2 /var/www/html/system/src/Grav/Common/GPM/Local/Plugins.php(31): Grav\Common\Plugins::all()
#3 /var/www/html/system/src/Grav/Common/GPM/Local/Packages.php(23): Grav\Common\GPM\Local\Plugins->__construct()
#4 /var/www/html/system/src/Grav/Common/GPM/GPM.php(67): Grav\Common\GPM\Local\Packages->__construct()
#5 /var/www/html/user/plugins/update-notifications/update-notifications.php(85): Grav\Common\GPM\GPM->__construct()
#6 /var/www/html/user/plugins/update-notifications/update-notifications.php(67): Grav\Plugin\UpdateNotificationsPlugin::getUpdates()
#7 /var/www/html/user/plugins/update-notifications/update-notifications.php(58): Grav\Plugin\UpdateNotificationsPlugin::getNewUpdates()
#8 /var/www/html/system/src/Grav/Common/Scheduler/Job.php(449): Grav\Plugin\UpdateNotificationsPlugin::run()
#9 /var/www/html/system/src/Grav/Common/Scheduler/Job.php(338): Grav\Common\Scheduler\Job->exec()
#10 /var/www/html/system/src/Grav/Common/Scheduler/Scheduler.php(205): Grav\Common\Scheduler\Job->run()
#11 /var/www/html/system/src/Grav/Console/Cli/SchedulerCommand.php(213): Grav\Common\Scheduler\Scheduler->run()
#12 /var/www/html/system/src/Grav/Console/GravCommand.php(39): Grav\Console\Cli\SchedulerCommand->serve()
#13 /var/www/html/vendor/symfony/console/Command/Command.php(255): Grav\Console\GravCommand->execute()
#14 /var/www/html/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run()
#15 /var/www/html/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand()
#16 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#17 /var/www/html/bin/grav(42): Symfony\Component\Console\Application->run()
#18 {main}
thrown in /var/www/html/system/src/Grav/Common/Data/Data.php on line 203
```
After some debugging I found out that this extension was the problem, to be more specific this line

https://github.com/getgrav/grav-plugin-simplesearch/blob/54fc014ac70cc630278c35929b1000f6c823f7d8/simplesearch.php#L106C13-L106C83

It overwrites the config with another data type. It would work with appending a `->toArray()` after the `mergeConfig` call, but I'm not sure if this is the correct fix, but seems to work for me for the moment.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.