Bug #74860 [NEW]: Uncaught exceptions not being formatted properly when error_log set to "syslog"

From: Date: Wed, 05 Jul 2017 20:36:49 +0000
Subject: Bug #74860 [NEW]: Uncaught exceptions not being formatted properly when error_log set to "syslog"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209831@lists.php.net to get a copy of this message
From: philipp at redfish-solutions dot com Operating system: linux 4.9.30 PHP version: 7.1.6 Package: Output Control Bug Type: Bug Bug description:Uncaught exceptions not being formatted properly when error_log set to "syslog" Description: ------------ I'm using php-7.1.6 on Linux (LEDE master). During development, I had an uncaught exception which generated the diagnostic: 2017-07-05T11:56:20-06:00 PowercodeBMU Powercode: Error: Call to undefined function fetch() in /www/lib/php/LogController.php:48 Stack trace: #0 /tmp/foo.php(7): LogIterator->valid() #1 {main} i.e. 4 lines of text with embedded newlines. syslog() doesn't handle this correctly, as each line is supposed to be prefixed with a timestamp, hostname, and tag... but only the first line is formatted correctly because syslog() is handling the buffer as a single string. The correct behavior is to explode this message on newlines and then write each part to syslog individually. My php.ini file contained: error_log = "syslog"; Test script: --------------- Just about any uncaught exception should trigger this. Expected result: ---------------- Correct logging should look like: 2017-07-05T11:56:20-06:00 PowercodeBMU Powercode: Error: Call to undefined function fetch() in /www/lib/php/LogController.php:48 2017-07-05T11:56:20-06:00 PowercodeBMU Powercode: Stack trace: 2017-07-05T11:56:20-06:00 PowercodeBMU Powercode: #0 /tmp/foo.php(7): LogIterator->valid() 2017-07-05T11:56:20-06:00 PowercodeBMU Powercode: #1 {main} note that each line is prefixed identically. Actual result: -------------- Per description. -- Edit bug report at https://bugs.php.net/bug.php?id=74860&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74860&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74860&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74860&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74860&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74860&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74860&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74860&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74860&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74860&r=support Expected behavior: https://bugs.php.net/fix.php?id=74860&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74860&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74860&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74860&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74860&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74860&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74860&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74860&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74860&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74860&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74860&r=mysqlcfg

« previous php.bugs (#209831) next »