From: Sam Reed Date: Fri, 16 Sep 2011 20:08:33 +0000 (+0000) Subject: Noticed in apache error logs (see below). If the length of the message is longer... X-Git-Tag: 1.31.0-rc.0~27603 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=a9d458a2cc7e098928b430277000b7c1dfcbf36f;p=lhc%2Fweb%2Fwiklou.git Noticed in apache error logs (see below). If the length of the message is longer than the maximum length, only send what will fit Sep 16 20:07:28 10.0.2.193 apache2[28441]: PHP Warning: socket_sendto() [function.socket-sendto]: unable to write to socket [90]: Message too long in /home/wikipedia/common/php-1.17-test/includes/GlobalFunctions.php on line 464 Sep 16 20:07:29 10.0.2.193 apache2[26511]: PHP Warning: socket_sendto() [function.socket-sendto]: unable to write to socket [90]: Message too long in /home/wikipedia/common/php-1.17-test/includes/GlobalFunctions.php on line 464 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 33cff2c59e..13fe67f0b7 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -867,7 +867,14 @@ function wfErrorLog( $text, $file ) { if ( !$sock ) { return; } - socket_sendto( $sock, $text, strlen( $text ), 0, $host, $port ); + + $len = strlen( $text ); + $maxLen = socket_get_option( $sock, SOL_UDP, SO_SNDBUF ); + + if ( $len > $maxLen ) { + $len = $maxLen - 1; + } + socket_sendto( $sock, $text, $len, 0, $host, $port ); socket_close( $sock ); } else { wfSuppressWarnings();