Edit report at http://pear.php.net/bugs/bug.php?id=17874&edit=1
ID: 17874
Comment by: [email protected]
Reported By: d dot reiche at gmx dot ch
Summary: logging to console with standard options gives PHP
NOTICE
Status: Open
Type: Bug
Package: Log
Operating System: Ubuntu 10.04
Package Version: 1.12.2
PHP Version: 5.3.3
Roadmap Versions:
New Comment:
In the test script, I believe you mean "error_reporting" instead of
"error_handling".
The unavailability of STDOUT/STDIN isn't really explicitly documented
(though it is alluded to in this bug:
http://bugs.php.net/bug.php?id=42091).
I'm attaching a patch that does tracking to see if the class should be
responsible for closing the resource, uses STDOUT if it is defined,
otherwise it calls fopen on php://output and properly fcloses that on
the deconstructor. The PHP NOTICE is resolved and all original
functionality is maintained.
Previous Comments:
------------------------------------------------------------------------
[2010-09-20 10:11:17] bigbadbassman
Description:
------------
Creating a console logger (from LOG::singleton() ) leads to the
following PHP NOTICE error:
Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in
/usr/share/php/Log.php on line 148 Call Stack:
It does not matter, if options array is specified with stream =>
'STDOUT'.
A constant STDOUT does not exist.
Test script:
---------------
<?php
error_handling(E_ALL);
$console = Log::singleton('console', '', 'SomeName');
Expected result:
----------------
No Error message
Actual result:
--------------
Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in
/usr/share/php/Log.php on line 148 Call Stack: <your call stack here.>
------------------------------------------------------------------------