From 413fa8bcb3ecd266f24b1accb24b0ac889a4be4f Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 23 Sep 2011 14:14:55 +0000 Subject: [PATCH] Mostly revert r97328 Swap substring to be done on smaller (more correct) values --- includes/GlobalFunctions.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index cbe28c26e1..eb6172059f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -852,15 +852,15 @@ function wfErrorLog( $text, $file ) { $text = preg_replace( '/^/m', $prefix . ' ', $text ); // Limit to 64KB - if ( strlen( $text ) > 65534 ) { - $text = substr( $text, 0, 65534 ); + if ( strlen( $text ) > 65506 ) { + $text = substr( $text, 0, 65505 ); } if ( substr( $text, -1 ) != "\n" ) { $text .= "\n"; } - } elseif ( strlen( $text ) > 65535 ) { - $text = substr( $text, 0, 65535 ); + } elseif ( strlen( $text ) > 65507 ) { + $text = substr( $text, 0, 65506 ); } $sock = socket_create( $domain, SOCK_DGRAM, SOL_UDP ); @@ -868,13 +868,7 @@ function wfErrorLog( $text, $file ) { return; } - $len = strlen( $text ); - $maxLen = socket_get_option( $sock, SOL_SOCKET, SO_SNDBUF ); - - if ( $len > $maxLen ) { - $len = $maxLen - 1; - } - socket_sendto( $sock, $text, $len, 0, $host, $port ); + socket_sendto( $sock, $text, strlen( $text ), 0, $host, $port ); socket_close( $sock ); } else { wfSuppressWarnings(); -- 2.20.1