Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument #1 is not an array in /var/apps/client_app/vendor/silverstripe/config/src/Middleware/DeltaMiddleware.php on line 95 #44

Open
brynnb opened this issue Jul 20, 2020 · 4 comments

Comments

@brynnb
Copy link

brynnb commented Jul 20, 2020

Hello,

My team is getting this error when trying to run dev/build of a Silverstripe site we just upgraded from 3 to 4.5. It does seem to successfully finish the build, though, and the site appears to be working properly.

image

Here is the full stack trace:

`
Trace

array_merge(, Array)
DeltaMiddleware.php:95
SilverStripe\Config\Middleware\DeltaMiddleware->applyDelta(, Array)
DeltaMiddleware.php:79
SilverStripe\Config\Middleware\DeltaMiddleware->getClassConfig(SilverStripe\View\SSViewer, 5, Closure)
MiddlewareAware.php:56
SilverStripe\Config\Collections\MemoryConfigCollection->SilverStripe\Config\Middleware\{closure}(SilverStripe\View\SSViewer, 5)
MiddlewareAware.php:59
SilverStripe\Config\Collections\MemoryConfigCollection->callMiddleware(SilverStripe\View\SSViewer, 5, Closure)
MemoryConfigCollection.php:141
SilverStripe\Config\Collections\MemoryConfigCollection->getClassConfig(SilverStripe\View\SSViewer, 5)
MemoryConfigCollection.php:104
SilverStripe\Config\Collections\MemoryConfigCollection->get(SilverStripe\View\SSViewer, , 5)
ExtensionMiddleware.php:59
SilverStripe\Core\Config\Middleware\ExtensionMiddleware->getExtraConfig(SilverStripe\View\SSViewer, , 1)
ExtensionMiddleware.php:41
SilverStripe\Core\Config\Middleware\ExtensionMiddleware->getClassConfig(SilverStripe\View\SSViewer, 1, Closure)
MiddlewareAware.php:56
SilverStripe\Config\Collections\MemoryConfigCollection->SilverStripe\Config\Middleware\{closure}(SilverStripe\View\SSViewer, 1)
InheritanceMiddleware.php:30
SilverStripe\Core\Config\Middleware\InheritanceMiddleware->getClassConfig(SilverStripe\View\SSViewer, 1, Closure)
MiddlewareAware.php:56
SilverStripe\Config\Collections\MemoryConfigCollection->SilverStripe\Config\Middleware\{closure}(SilverStripe\View\SSViewer, 1)
DeltaMiddleware.php:73
SilverStripe\Config\Middleware\DeltaMiddleware->getClassConfig(SilverStripe\View\SSViewer, 1, Closure)
MiddlewareAware.php:56
SilverStripe\Config\Collections\MemoryConfigCollection->SilverStripe\Config\Middleware\{closure}(SilverStripe\View\SSViewer, 1)
MiddlewareAware.php:59
SilverStripe\Config\Collections\MemoryConfigCollection->callMiddleware(SilverStripe\View\SSViewer, 1, Closure)
MemoryConfigCollection.php:141
SilverStripe\Config\Collections\MemoryConfigCollection->getClassConfig(SilverStripe\View\SSViewer, 1)
MemoryConfigCollection.php:104
SilverStripe\Config\Collections\MemoryConfigCollection->get(SilverStripe\View\SSViewer, theme_enabled, 1)
Config_ForClass.php:96
SilverStripe\Core\Config\Config_ForClass->get(theme_enabled, 1)
Config_ForClass.php:129
SilverStripe\Core\Config\Config_ForClass->uninherited(theme_enabled)
SSViewer.php:277
SilverStripe\View\SSViewer::get_themes()
SSViewer.php:430
SilverStripe\View\SSViewer::chooseTemplate(Array)
SSViewer.php:418
SilverStripe\View\SSViewer->setTemplate(Array)
SSViewer.php:202
SilverStripe\View\SSViewer->__construct(Array)
ReflectionClass->newInstanceArgs(Array)
InjectionCreator.php:23
SilverStripe\Core\Injector\InjectionCreator->create(SilverStripe\View\SSViewer, Array)
Injector.php:594
SilverStripe\Core\Injector\Injector->instantiate(Array, SilverStripe\View\SSViewer, prototype)
Injector.php:1002
SilverStripe\Core\Injector\Injector->getNamedService(SilverStripe\View\SSViewer, , Array)
Injector.php:955
SilverStripe\Core\Injector\Injector->get(SilverStripe\View\SSViewer, , Array)
Injector.php:1125
SilverStripe\Core\Injector\Injector->createWithArgs(SilverStripe\View\SSViewer, Array)
Injectable.php:30
SilverStripe\View\SSViewer::create(Array)
AssetAdapter.php:189
SilverStripe\Assets\Flysystem\AssetAdapter->renderTemplate(SilverStripe\Assets\Flysystem\PublicAssetAdapter_HTAccess)
AssetAdapter.php:154
SilverStripe\Assets\Flysystem\AssetAdapter->configureServer(1)
AssetAdapter.php:120
SilverStripe\Assets\Flysystem\AssetAdapter->flush()
FlysystemAssetStore.php:1450
SilverStripe\Assets\Flysystem\FlysystemAssetStore::flush()
FlushMiddleware.php:23
SilverStripe\Control\Middleware\FlushMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
RequestProcessor.php:66
SilverStripe\Control\RequestProcessor->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
SessionMiddleware.php:20
SilverStripe\Control\Middleware\SessionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
AllowedHostsMiddleware.php:60
SilverStripe\Control\Middleware\AllowedHostsMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
TrustedProxyMiddleware.php:176
SilverStripe\Control\Middleware\TrustedProxyMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
HTTPMiddlewareAware.php:65
SilverStripe\Control\Director->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
Director.php:369
SilverStripe\Control\Director->handleRequest(SilverStripe\Control\HTTPRequest)
HTTPApplication.php:117
SilverStripe\Control\HTTPApplication::SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
call_user_func(Closure, SilverStripe\Control\HTTPRequest)
HTTPApplication.php:136
SilverStripe\Control\HTTPApplication->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
HTTPMiddlewareAware.php:65
SilverStripe\Control\HTTPApplication->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
HTTPApplication.php:137
SilverStripe\Control\HTTPApplication->execute(SilverStripe\Control\HTTPRequest, Closure, 1)
HTTPApplication.php:118
SilverStripe\Control\HTTPApplication->handle(SilverStripe\Control\HTTPRequest)
index.php:24

`

On PHP 7.2.24. Let me know if there's any other relevant information I can provide.

@robbieaverill
Copy link
Contributor

This is likely caused by user-defined configuration. Could you debug this and report back on what $delta['config'] is in this case?

@brynnb
Copy link
Author

brynnb commented Jul 20, 2020

print_r($delta['config']) results in "Array ( [source_file_comments] => )" and print_r($delta['config']['source_file_comments']); results in no output

Is that helpful?

@brynnb
Copy link
Author

brynnb commented Jul 20, 2020

And to clarify, the first argument (which seems maybe the one causing the error) is an empty string.

@lekoala
Copy link
Contributor

lekoala commented Jun 23, 2023

maybe a simple if(!$config) return would be enough to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants