We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Bug in \Phalcon\Debug?

I have a parse error in my bootstrap.php file. However, the error I'm getting is:

Fatal error: Uncaught Phalcon\Tag\Exception: A dependency injector container is required to obtain the 'url' service in phalcon/tag.zep:199 Stack trace: #0 [internal function]: Phalcon\Tag::getUrlService() #1 [internal function]: Phalcon\Tag::linkTo(Array) #2 [internal function]: Phalcon\Debug->getVersion() #3 [internal function]: Phalcon\Debug->onUncaughtException(Object(ParseError)) #4 {main} thrown in phalcon/tag.zep on line 199

If I comment out this line in my index.php: $Debug->listen();, then I see the native PHP error.

If this is a bug, I'm happy to report it on GitHub - I just want to see if anyone has an alternate explanation.

edited Aug '17

You need to initialize DI before loading debug. As Debug class is using a tag manager, which is initialized on DI as one of default services. E.g.:

<?php
$di = new \Phalcon\Di\FactoryDefault();
$debug = (new \Phalcon\Debug())->listen();
// ...
// Load services e.t.c.
// ...
// Handle app
// ...