Skip to content

Setting mergeConfig breaks scheduler #205

@buergi

Description

@buergi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions