Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.14.4

Bug #17874 logging to console with standard options gives PHP NOTICE
Submitted: 2010-09-20 14:11 UTC
From: bigbadbassman Assigned: jon
Status: Closed Package: Log (version 1.12.2)
PHP Version: 5.3.3 OS: Ubuntu 10.04
Roadmaps: (Not assigned)    
Subscription  


 [2010-09-20 14:11 UTC] bigbadbassman (Daniel Reiche)
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.>

Comments

 [2010-12-24 01:48 UTC] ecaron (Eric Caron)
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.
 [2010-12-24 01:49 UTC] ecaron (Eric Caron)
 [2010-12-24 05:26 UTC] jon (Jon Parise)
-Status: Open +Status: Closed -Assigned To: +Assigned To: jon
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.