Debugging NotORM Call Results in "Use of undefined constant STDERR - assumed 'STDERR'"

StackOverflow https://stackoverflow.com/questions/16696107

  •  30-05-2022
  •  | 
  •  

Pregunta

I am debugging a project that uses Slim and NotORM on PHP 5.4. When setting NotORM to debug mode the NotORM trace statement:

fwrite(STDERR, "$backtrace[file]:$backtrace[line]:$debug\n");

throws the following error:

"Use of undefined constant STDERR - assumed 'STDERR'"

I have a feeling the problem is Slim as the error message does not show up when executing Php command line scripts.

Does anyone know how to fix this issue (preferably without modifying NotORM)?

Thanks in advance.

¿Fue útil?

Solución

STDERR is only defined for CLI applications. Apparently, NotORM debug mode requires a workaround for web applications.

Otros consejos

It's also possible to specify a callback instead of a boolean (using symfony/var-dumper for printing the information in this example):

$database->debug = function($query, $params) 
{
    dump(['query' => $query, 'params' => $params]);
};
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top