Using Elgg 2.3.14 I'm attempting to render one of my plugin view pages and receive the error:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Elgg\Http\ResponseFactory::__construct(), 4 passed in /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/Di/ServiceProvider.php on line 359 and exactly 5 expected in /var/www/html/mod/fc-plugin/views/default/resources/vendor/elgg/elgg/engine/classes/Elgg/Http/ResponseFactory.php:69 Stack trace: #0 /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/Di/ServiceProvider.php(359): Elgg\Http\ResponseFactory->__construct(Object(Elgg\Http\Request), Object(Elgg\PluginHooksService), Object(Elgg\Ajax\Service), Object(Elgg\Http\HttpProtocolTransport)) #1 [internal function]: Elgg\Di\ServiceProvider->Elgg\Di\{closure}(Object(Elgg\Di\ServiceProvider)) #2 /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/Di/DiContainer.php(68): call_user_func(Object(Closure), Object(Elgg\Di\ServiceProvider)) #3 /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/Di/DiContainer.php(48): Elgg\Di\DiContainer->build(Object(Closure), 'responseFactory') #4 /var/www/html/vendor/elgg/elgg/e in /var/www/html/mod/fc-plugin/views/default/resources/vendor/elgg/elgg/engine/classes/Elgg/Http/ResponseFactory.php on line 69
Looks as though the constructor in ResponseFactory.php is expecting 5 arguments, but the ServiceProvider.php file is only passing in 4 arguments. This seems to be an issue with Elgg and not with my custom plugin code. Has anyone else experienced this issue?
Any help would be appreciated.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- TCB@tblack06

TCB - 0 likes
- Jeroen Dalsem@jdalsem

Jeroen Dalsem - 0 likes
You must log in to post replies.I figured out why this was happening. I had moved a copy of vendor/elgg/elgg.... into my plugin's resources directory and the ResponseFactory class was different in the plugin so it was overriding the original core ResponseFactory class.
If you use composer for your dependency management you can prevent this kind of issues