Debug system (phalcon 1.2.0)

HI i've watched this screencast : http://vimeo.com/68893840 and i really love the debug interface, so i tried to make it work.

I've started a new project (as i'm a new phalcon user ;)) with this doc : http://docs.phalconphp.com/en/latest/reference/tutorial.html#creating-a-project and i stopped after IndexController.

It displays "Hello" like it's supposed to do, so i've add an error in the echo (i've deleted the ";" at the end of the line), as expected i've an error : http://imgur.com/F1xdAQM , then i write the line php (new Phalcon\Debug)->listen(); in public/index.php at the beginning of the file, but i still have the crappy orange error message instead of your interface.

What did i forgot ?

http://docs.phalconphp.com/en/latest/reference/debug.html#debug-component

Any Try/Catch blocks must be removed or disabled to make this component work properly.



2.2k

Hi boston, thank you for your response, i did what the doc says, here is my index.php : ```php <?php errorreporting(EALL); $debug = new \Phalcon\Debug(); $debug->listen();

//Register an autoloader
$loader = new \Phalcon\Loader();
$loader->registerDirs(array(
    '../app/controllers/',
    '../app/models/'
))->register();

//Create a DI
$di = new Phalcon\DI\FactoryDefault();

//Setting up the view component
$di->set('view', function(){
    $view = new \Phalcon\Mvc\View();
    $view->setViewsDir('../app/views/');
    return $view;
});

//Handle the request
$application = new \Phalcon\Mvc\Application($di);

echo $application->handle()->getContent();

```

I still have the orange error.

Hi! try: ```php errorreporting(1); iniset('displayerrors', 1); iniset('displaystartuperrors', 1); ```

what you Phalcon and php versin?



2.2k

If i put those 3 lines (instead of my errorreporting(EALL) i've nothing at all (blank page), my php version is : ```php PHP 5.4.6-1ubuntu1.2 (cli) (built: Mar 11 2013 14:57:54) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans ``` If i only put the init_sets i get the same orange error.

and my phalcon is 1.2.0 at least i hope so as i've followed the doc and get it from GIT, if you think i may not have to correct version how can i see it ?(i have phalcon dev. tools 1.2.0 if that may help)

hmm orange error? any printscreen? This componet use remote styles, so maybe your browser disallow it or something?



2.2k

Yeah i've put a link : http://imgur.com/F1xdAQM It's the standard php error display i guess :) i've it on both my windows and linux.

You have to fix your your script, use any IDE to see where you not close { or other typo errors.



2.2k

I know where i forgot to put the ";" i did it on purpose, i just want to have the beautiful error interface of Phalcon instead of the one i got.

but it is not for typo errors, your script need to be parsed properly, php don't know about Phalcon\Debug because it is not parsed by PHP. Phalcon\Debug is created to allow easily find error produced by Phalcon, eg, not found controller, action, etc, not to display typo errors.



2.2k

Thank you, i did just that, i put the ";" back and add an extra argument to \Phalcon\Mvc\Application() and i get the green interface. I've tried this before just like in the video but it didn't worked because i forgot to remove the try/catch...

So thank you, both ;)

I'm trying to use Phalcon\Debug component also, but I'm having a problem with low serverity errors. Whether they're displayed when something happens before an action is dispatched, they're shown in debug. If there's an error in action which is not an exception then these kind of errors are not catched at all (I've tried to access non existing variable in an action if a controller; I have errorreporting set to EALL | E_STRICT, display errors and startup errors set to 1). Is there a need to do something more to have low severity errors also seen other than (new \Phalcon\Debug)->listen(true, true) ?