nekudo/shiny_blog

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments...

phayz opened this issue · 2 comments

phayz commented

I am again trying Shiny Blog as I think it will meet all my needs for a simple, self-hosted, file-based blog. However, I can't get it working on my shared host, with PHP 7.1.

On my latest attempt, I have the following in Shiny Blog's error log. I can't understand the error messages, and hope someone here might be able to help.

[07-Aug-2017 03:19:28 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Nekudo\ShinyBlog\Core\Psr4Autoloader::addNamespace(), 2 passed in /home/phayzcom/public_html/shiny_blog/src/bootstrap.php on line 17 and exactly 3 expected in /home/phayzcom/public_html/shiny_blog/src/Core/Autoloader.php:38
Stack trace:
#0 /home/phayzcom/public_html/shiny_blog/src/bootstrap.php(17): Nekudo\ShinyBlog\Core\Psr4Autoloader->addNamespace('FastRoute\\', '/home/phayzcom/...')
#1 /home/phayzcom/public_html/shiny_blog/index.php(4): require('/home/phayzcom/...')
#2 {main}
  thrown in /home/phayzcom/public_html/shiny_blog/src/Core/Autoloader.php on line 38

I just tested the code with PHP versions 7.1.8 and 7.2beta but could not reproduce this error.

You can try to change the follwing lines of code in /src/bootstrap.php from

$loader->addNamespace('FastRoute\\', __DIR__ . '/../vendor/nikic/fast-route/src/');
$loader->addNamespace('Nekudo\\ShinyBlog\\', __DIR__ . '/../src/');

to

$loader->addNamespace('FastRoute\\', __DIR__ . '/../vendor/nikic/fast-route/src/', false);
$loader->addNamespace('Nekudo\\ShinyBlog\\', __DIR__ . '/../src/', false);
phayz commented

Thank you! With that change made, the previously reported errors have disappeared. http://phayz.com/shiny_blog/

The blog itself is still not loading, but this is definitely progress. I can successfully run Shiny Blog locally (Fedora 26), so the issue must be the configuration of my shared web host.