Bug #77913 [NEW]: error_log via syslog: PHP will split msg on line break
| From: | whissi at whissi dot de | Date: | Tue, 16 Apr 2019 17:35:56 +0000 |
| Subject: | Bug #77913 [NEW]: error_log via syslog: PHP will split msg on line break | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-220492@lists.php.net to get a copy of this message | ||
From: whissi at whissi dot de
Operating system:
PHP version: 7.3.4
Package: *General Issues
Bug Type: Bug
Bug description:error_log via syslog: PHP will split msg on line break
Description:
------------
PHP 7.3 introduced "syslog.filter" to control content send to syslog.
According to documentation
(https://www.php.net/manual/en/errorfunc.configuration.php#ini.syslog.filter),
"syslog.filter=all" should allow all characters (=same behavior like in
PHP 7.2 or before). However, even when set "syslog.filter=all" to allow
all characters including line breaks, when you now send a multi-line
message via error_log() through syslog, PHP splits message on line break
so you end up with multiple messages instead of sending one single
message like before.
Test script:
---------------
<?php
$message = "This is line #1" . PHP_EOL;
$message .= "This is line #2";
$iniSetting = ini_get('error_log');
if ($iniSetting !== 'syslog') {
die("You must set error_log=syslog!");
}
if (version_compare(phpversion(), '7.3', '>')) {
$iniSetting = ini_get('syslog.filter');
if ($iniSetting !== 'all') {
die("You must set syslog.filter=all!");
}
}
error_log($message);
print "Now please review your syslog!" . PHP_EOL;
Expected result:
----------------
When running test script like
> /usr/bin/php7.3 -d error_log=syslog -d syslog.filter=all test.php
I would expect one single syslog message like
> Apr 16 16:52:06 myhost php: This is line #1#012This is line #2
Actual result:
--------------
I am getting _two_ messages:
> Apr 16 16:53:20 myhost php: This is line #1
> Apr 16 16:53:20 myhost php: This is line #2
--
Edit bug report at https://bugs.php.net/bug.php?id=77913&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77913&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77913&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77913&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77913&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77913&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77913&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77913&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77913&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77913&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77913&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77913&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77913&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77913&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77913&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77913&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77913&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77913&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77913&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77913&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77913&r=mysqlcfg