ingeniasoftware / luthier-ci

Improved routing, middleware support, authentication tools and more for CodeIgniter 3 framework
https://luthier.ingenia.me/ci/en/
MIT License
151 stars 39 forks source link

Debug Bar not work #23

Closed primapwd closed 6 years ago

primapwd commented 6 years ago

Hi, I try Debug Bar, follow the docs and it didn't displayed at all. I found that Debugbar::init() doesn't called automatically. When I call Debugbar::init() manually, Luthier-CI throws an error Luthier\Exception\RouteNotFoundException.

An uncaught Exception was encountered
Type: Luthier\Exception\RouteNotFoundException

Message: (null)

Filename: E:\xampp\htdocs\app\vendor\luthier\luthier\src\RouteBuilder.php

Line Number: 391

Backtrace:

File: E:\xampp\htdocs\app\vendor\luthier\luthier\src\Functions.php
Line: 28
Function: getByName

File: E:\xampp\htdocs\app\vendor\luthier\luthier\src\Debug.php
Line: 171
Function: route

File: E:\xampp\htdocs\app\vendor\luthier\luthier\src\Hook.php
Line: 473
Function: prepareOutput

File: E:\xampp\htdocs\app\vendor\luthier\luthier\src\Hook.php
Line: 69
Function: displayOverrideHook

File: E:\xampp\htdocs\app\index.php
Line: 315
Function: require_once

And the error disappear after I commented Debugbar::init() line. This is my hooks.php file:

$hook = Luthier\Hook::getHooks(
    [
        'modules' => ['Debug']
    ]
);

Any thoughts?

In case you need this information: PHP 5.6 CodeIgniter 3.1.8 Luthier-CI 1.0.1

primapwd commented 6 years ago

Well, I found that in_array('debug', $config['modules']) always return false because case-sensitive key. https://github.com/ingeniasoftware/luthier-ci/blob/83eb6a690129f675de014e5dcb559741343bdef8/src/Hook.php#L167

And when I change hooks.php like this

$hook = Luthier\Hook::getHooks(
    [
        'modules' => ['debug']
    ]
);

it throws another error.

Fatal error: Default value for parameters with a class type hint can only be NULL in E:\xampp\htdocs\app\vendor\symfony\var-dumper\Dumper\CliDumper.php on line 61

Fatal error: Class 'CI_Exceptions' not found in E:\xampp\htdocs\app\system\core\Common.php on line 196
andersonsalas commented 6 years ago

Sorry about that, as you may noticed there is a misspelling in the online documentation, it's debug not Debug:

$hook = Luthier\Hook::getHooks(
    [
        'modules' => ['debug']
    ]
);

About the other error, please make sure that your composer PHP version matches your server PHP version. It seems that you are using PHP 7 dependencies on a server running PHP 5. Just for being sure, type in your console php -v and then compare the version number with the output of phpinfo() in any script of your server.

primapwd commented 6 years ago

Oopss, you're right. I have different PHP version installed. Will close this issue then. Thanks a lot.