Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -411,13 +411,18 @@ |
412 | 412 | // IPv6 bracketed host |
413 | 413 | $protocol = $m[1]; |
414 | 414 | $host = $m[2]; |
415 | | - $port = $m[3]; |
| 415 | + $port = intval( $m[3] ); |
416 | 416 | $prefix = isset( $m[4] ) ? $m[4] : false; |
| 417 | + $domain = AF_INET6; |
417 | 418 | } elseif ( preg_match( '!^(tcp|udp):(?://)?([a-zA-Z0-9.-]+):(\d+)(?:/(.*))?$!', $file, $m ) ) { |
418 | 419 | $protocol = $m[1]; |
419 | 420 | $host = $m[2]; |
420 | | - $port = $m[3]; |
| 421 | + if ( !IP::isIPv4( $host ) ) { |
| 422 | + $host = gethostbyname( $host ); |
| 423 | + } |
| 424 | + $port = intval( $m[3] ); |
421 | 425 | $prefix = isset( $m[4] ) ? $m[4] : false; |
| 426 | + $domain = AF_INET; |
422 | 427 | } else { |
423 | 428 | throw new MWException( __METHOD__.": Invalid UDP specification" ); |
424 | 429 | } |
— | — | @@ -429,12 +434,12 @@ |
430 | 435 | } |
431 | 436 | } |
432 | 437 | |
433 | | - $sock = fsockopen( "$protocol://$host", $port ); |
| 438 | + $sock = socket_create( $domain, SOCK_DGRAM, SOL_UDP ); |
434 | 439 | if ( !$sock ) { |
435 | 440 | return; |
436 | 441 | } |
437 | | - fwrite( $sock, $text ); |
438 | | - fclose( $sock ); |
| 442 | + socket_sendto( $sock, $text, strlen( $text ), 0, $host, $port ); |
| 443 | + socket_close( $sock ); |
439 | 444 | } else { |
440 | 445 | wfSuppressWarnings(); |
441 | 446 | $exists = file_exists( $file ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -638,6 +638,8 @@ |
639 | 639 | * (bug 21455) Fixed "Watch this page" checkbox appearing on some special pages |
640 | 640 | even to non-logged in users |
641 | 641 | * (bug 21551) Make Squid reponse limit configurable |
| 642 | +* Fixed corruption of long UDP debug log messages by using socket_sendto() |
| 643 | + instead of fsockopen() with fwrite(). |
642 | 644 | |
643 | 645 | == API changes in 1.16 == |
644 | 646 | |