Zend FR

Consultez la FAQ sur le ZF avant de poster une question

Vous n'êtes pas identifié.

#1 12-01-2009 15:07:52

epasquier
Membre
Date d'inscription: 12-01-2009
Messages: 15

exception stack trace avec retour ligne

Bonjour,
Lors d'une exception, le "stack trace" est affiché sans retour ligne (ou plus exactement sans <br /> dans le code html généré).
Il y a-t-il une option pour avoir un affichage plus lisible ?

Cdt,
Eric.

Hors ligne

 

#2 12-01-2009 16:22:58

Julien
Membre
Date d'inscription: 16-03-2007
Messages: 501

Re: exception stack trace avec retour ligne

function toto($e)
{
    echo wordwrap($e, 10, '<br />');
}

set_exception_handler('toto');

Par exemple

Hors ligne

 

#3 12-01-2009 16:30:17

philippe
Administrateur
Lieu: Grenoble
Date d'inscription: 01-03-2007
Messages: 1624

Re: exception stack trace avec retour ligne

L'autre solution c'est de regarder le code source de ta page, tu as bien les retours à la ligne de ta stack

A+, Philippe


twitter : @plv ; kitpages.fr : Création de sites internet à Grenoble et Paris

Hors ligne

 

#4 12-01-2009 16:32:58

epasquier
Membre
Date d'inscription: 12-01-2009
Messages: 15

Re: exception stack trace avec retour ligne

Code affiché:

Fatal error: Uncaught exception 'Zend_Controller_Action_Exception' with message 'Action "forgotsend" does not exist and was not trapped in __call()' in C:\wamp\ZF\Zend\Controller\Action.php:474 Stack trace: #0 C:\wamp\ZF\Zend\Controller\Action.php(505): Zend_Controller_Action->__call('forgotsendActio...', Array) #1 C:\wamp\ZF\Zend\Controller\Dispatcher\Standard.php(285): Zend_Controller_Action->dispatch('forgotsendActio...') #2 C:\wamp\ZF\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #3 C:\wamp\www\hrs5\app_hrs\bootstrap.php(55): Zend_Controller_Front->dispatch() #4 C:\wamp\www\hrs5\index.php(22): require('C:\wamp\www\hrs...') #5 {main} thrown in C:\wamp\ZF\Zend\Controller\Action.php on line 474

Code HTML:
<br />
<b>Fatal error</b>:  Uncaught exception 'Zend_Controller_Action_Exception' with message 'Action &quot;forgotsend&quot; does not exist and was not trapped in __call()' in C:\wamp\ZF\Zend\Controller\Action.php:474
Stack trace:
#0 C:\wamp\ZF\Zend\Controller\Action.php(505): Zend_Controller_Action-&gt;__call('forgotsendActio...', Array)
#1 C:\wamp\ZF\Zend\Controller\Dispatcher\Standard.php(285): Zend_Controller_Action-&gt;dispatch('forgotsendActio...')
#2 C:\wamp\ZF\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard-&gt;dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#3 C:\wamp\www\hrs5\app_hrs\bootstrap.php(55): Zend_Controller_Front-&gt;dispatch()
#4 C:\wamp\www\hrs5\index.php(22): require('C:\wamp\www\hrs...')
#5 {main}
  thrown in <b>C:\wamp\ZF\Zend\Controller\Action.php</b> on line <b>474</b><br />


Il n'y pas les <br /> au bout de chaque ligne.

Hors ligne

 

#5 12-01-2009 17:02:30

epasquier
Membre
Date d'inscription: 12-01-2009
Messages: 15

Re: exception stack trace avec retour ligne

Merci Julien pour ton exemple.
Il ne fonctionne pas (ça coupe la ligne tous les 10 caractères), mais je m'en suis inspiré pour trouver la solution :

function exception_handler($e)
{
  $order   = array("\r\n", "\n", "\r");
  $replace = '<br />';

  // Traitement du premier \r\n, ils ne seront pas convertis deux fois.
  echo  str_replace($order, $replace, $e);
}
set_exception_handler('exception_handler');

Eric.

Hors ligne

 

#6 12-01-2009 17:39:54

philippe
Administrateur
Lieu: Grenoble
Date d'inscription: 01-03-2007
Messages: 1624

Re: exception stack trace avec retour ligne

tu peux aussi utiliser nl2br($string) smile


twitter : @plv ; kitpages.fr : Création de sites internet à Grenoble et Paris

Hors ligne

 

Pied de page des forums

Propulsé par PunBB
© Copyright 2002–2005 Rickard Andersson
Traduction par punbb.fr

Graphisme réalisé par l'agence Rodolphe Eveilleau
Développement par Kitpages