php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18090 Windows has less loglevels
Submitted: 2002-07-01 10:49 UTC Modified: 2002-07-02 05:52 UTC
From: mike at blueroot dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.1 OS: Win32
Private report: No CVE-ID:
 [2002-07-01 10:49 UTC] mike at blueroot dot net
The following code shows the error

print_r(array(
            LOG_EMERG   => 'emergency',
            LOG_ALERT   => 'alert',
            LOG_CRIT    => 'critical',
            LOG_ERR     => 'error',
            LOG_WARNING => 'warning',
            LOG_NOTICE  => 'notice',
            LOG_INFO    => 'info',
            LOG_DEBUG   => 'debug'
        ));

outputs 

Array ( [1] => critical [4] => error [5] => warning [6] => debug )

seems to work on *nix

The array above is used in PEAR::Log

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-02 04:43 UTC] cox@php.net
Do you mean that instead of the complete list:
Array
(
    [0] => emergency
    [1] => alert
    [2] => critical
    [3] => error
    [4] => warning
    [5] => notice
    [6] => info
    [7] => debug
)

You get under Windows only:

Array ( [1] => critical [4] => error [5] => warning [6] => debug )

?

What does this output?
<?php
error_reporting(E_ALL);
echo LOG_EMERG . " \n";
echo LOG_ALERT;
?>

Tomas V.V.Cox
 [2002-07-02 04:56 UTC] cox@php.net
Someone tested the constant values under Windows and they are different than under Linux, so for example LOG_EMERG, LOG_ALERT and LOG_CRIT are all equal to "1" breaking the array. I don't know if it's the expected behaviour to have this strange thing that way under Windows, anyways this is definetly not a PEAR problem.

Tomas V.V.Cox
 [2002-07-02 04:58 UTC] derick@php.net
And it's also not a bug, as Windows just have less log levels, we map it like this:
#define LOG_EMERG   1
#define LOG_ALERT   1
#define LOG_CRIT    1
#define LOG_ERR     4
#define LOG_WARNING 5
#define LOG_NOTICE  6
#define LOG_INFO    6
#define LOG_DEBUG   6

So the behavior you're seeing is perfectly normal.

Derick
 [2002-07-02 05:52 UTC] cox@php.net
Bogus then :-) Additional info for Windows for the record:

 LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR   => EVENTLOG_ERROR_TYPE
   LOG_WARNING                             => EVENTLOG_WARNING_TYPE
   LOG_NOTICE, LOG_INFO, LOG_DEBUG         => EVENTLOG_INFORMATION_TYPE

Tomas V.V.Cox

PS.- I've already reported the right "problem" in PEAR Log, but this is another bussiness not related to the original bug "subject" (which you have answered).
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 01:01:56 2014 UTC