FAQ
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.>

------------------------------------------------------------------------

Search Discussions

  • Jon at Dec 23, 2010 at 11:24 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=17874&edit=1

    ID: 17874
    Updated by: [email protected]
    Reported By: d dot reiche at gmx dot ch
    Summary: logging to console with standard options gives PHP
    NOTICE
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: Log
    Operating System: Ubuntu 10.04
    Package Version: 1.12.2
    PHP Version: 5.3.3
    -Assigned To:
    +Assigned To: jon
    Roadmap Versions:
    New Comment:

    -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.




    Previous Comments:
    ------------------------------------------------------------------------

    [2010-12-23 20:49:18] ecaron

    Added #patch bug:17874;patch:console-stdout-patch;revision:1293137358;.

    ------------------------------------------------------------------------

    [2010-12-23 20:48:57] ecaron

    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-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.>

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 23, '10 at 7:47p
activeDec 23, '10 at 11:24p
posts2
users2
websitepear.php.net

2 users in discussion

Jon: 1 post Eric Caron: 1 post

People

Translate

site design / logo © 2023 Grokbase