Mostly revert r97328
authorSam Reed <reedy@users.mediawiki.org>
Fri, 23 Sep 2011 14:14:55 +0000 (14:14 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Fri, 23 Sep 2011 14:14:55 +0000 (14:14 +0000)
Swap substring to be done on smaller (more correct) values

includes/GlobalFunctions.php

index cbe28c2..eb61720 100644 (file)
@@ -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();