From:             
Operating system: Windows
PHP version:      Irrelevant
Package:          Win32API related
Bug Type:         Feature/Change Request
Bug description:LOG_ level constants don't comply with RFC 3164 on Windows

Description:
------------
On Windows, the LOG_* constant values differ from the values defined in RFC
3164.  The values are correct on Unix platforms.

Previously discussed in https://bugs.php.net/bug.php?id=18090 and closed as
bogus back in 2002.

Over at Drupal, we replaced custom log level constants with PHP's native
LOG_* constants: http://drupal.org/node/1136130 -- and had to learn the
hard way that the constant values differ on Windows. (undocumented:
http://php.net/manual/en/network.constants.php)

Drupal uses these severity levels for application-level logging.  The
logger is pluggable, so messages may be stored in a database, third-party
system, or simply passed to syslog().  Depending on the logger
implementation, messages may also be listed/read.  Therefore, consistent
log severity level constant values are required.

The question arose why PHP overrides the LOG_* constant values on Windows,
kinda violating the RFC, and whether the reduction to values supported by
Windows' event log could not happen in a Windows-specific syslog()
implementation instead, not affecting the global run-time constants.

I understand that it's Windows that's to blame.  However, I don't see why
PHP has to follow Windows' bogus lead on not respecting the RFC. 
Conforming to industry standards would be a huge benefit for
interoperability with other systems.

Concrete change request:

- Make PHP's LOG_* constant values always conform to RFC 3164.

- Move the platform-specific mapping/reduction into a syslog()
implementation for Windows.


Test script:
---------------
<?php
var_dump(LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE,
LOG_INFO, LOG_DEBUG);
?>

Expected result:
----------------
int(0)
int(1)
int(2)
int(3)
int(4)
int(5)
int(6)
int(7)


Actual result:
--------------
int(1)
int(1)
int(1)
int(4)
int(5)
int(6)
int(6)
int(6)


-- 
Edit bug report at https://bugs.php.net/bug.php?id=55129&edit=1
-- 
Try a snapshot (PHP 5.2):            
https://bugs.php.net/fix.php?id=55129&r=trysnapshot52
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=55129&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=55129&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=55129&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55129&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=55129&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=55129&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=55129&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=55129&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=55129&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=55129&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=55129&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=55129&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=55129&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=55129&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55129&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=55129&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=55129&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=55129&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=55129&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=55129&r=mysqlcfg
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=55129&r=trysnapshot54

Reply via email to