http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97919

Revision: 97919
Author:   reedy
Date:     2011-09-23 14:14:55 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
Mostly revert r97328

Swap substring to be done on smaller (more correct) values

Modified Paths:
--------------
    trunk/phase3/includes/GlobalFunctions.php

Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php   2011-09-23 14:08:18 UTC (rev 
97918)
+++ trunk/phase3/includes/GlobalFunctions.php   2011-09-23 14:14:55 UTC (rev 
97919)
@@ -852,15 +852,15 @@
                        $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 @@
                        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();


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to