Il 06/10/2014 17:48, Leonardo Serni ha scritto:
> On Mon, 06 Oct 2014 13:58:56 +0200, alex
> <1j94...@lnx159sneakemail.com.invalid> wrote:
>
>> Come già accennato nell'altro postm dai un occhiata qui [ metodo debug() ]
>>
http://symfony.com/legacy/doc/jobeet/1_4/it/09?orm=Doctrine
>
> Ma quella e' appunto una funzione di debug; e' fatta apposta per iniettare del
> contenuto su stdout...
però nel caso seguente mi sembra che l'output sia stampato direttamente
a video
public function debug($realOutput = false)
{
print $this->tester->error('Response debug');
if (!$realOutput && null !== sfException::getLastException())
{
// print the exception and the stack trace instead of the
"normal" output
$this->tester->comment('WARNING');
$this->tester->comment('An error occurred when processing this
request.');
$this->tester->comment('The real response content has been
replaced with the exception message to ease debugging.');
}
printf("HTTP/1.X %s\n", $this->response->getStatusCode());
foreach ($this->response->getHttpHeaders() as $name => $value)
{
printf("%s: %s\n", $name, $value);
}
foreach ($this->response->getCookies() as $cookie)
{
vprintf("Set-Cookie: %s=%s; %spath=%s%s%s%s\n", array(
$cookie['name'],
$cookie['value'],
null === $cookie['expire'] ? '' : sprintf('expires=%s; ',
date('D d-M-Y H:i:s T', $cookie['expire'])),
$cookie['path'],
$cookie['domain'] ? sprintf('; domain=%s', $cookie['domain']) : '',
$cookie['secure'] ? '; secure' : '',
$cookie['httpOnly'] ? '; HttpOnly' : '',
));
}
echo "\n";
if (!$realOutput && null !== $exception =
sfException::getLastException())
{
echo $exception;
}
else
{
echo $this->response->getContent();
}
echo "\n";
exit(1);
}
> Li', l'errore (architetturale) sarebbe pensare di AVERE
> l'accesso al suo output, non di non averlo.
>
non ho capito il gioco di parole :)
> Header(), la funzione (quale che sia) che manda l'output finale al browser, e,
> ovviamente, cose come crash(), var_dump(), ecc., l'output possono averlo... o,
> addirittura, devono.
certo ci sono sempre le eccezioni