User "Tim Starling" posted a comment on MediaWiki.r97328. Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97328#c23058 Commit summary:
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() [<a href='function.socket-sendto'>function.socket-sendto</a>]: 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() [<a href='function.socket-sendto'>function.socket-sendto</a>]: unable to write to socket [90]: Message too long in /home/wikipedia/common/php-1.17-test/includes/GlobalFunctions.php on line 464 Comment: The PHP manual is not the best place to look for documentation. socket_get_option() is just a wrapper for getsockopt(). PHP's description of it is just a summary of the underlying platform documentation, for example the relevant Linux man pages. The socket options that go with SOL_SOCKET are documented on [http://manpages.ubuntu.com/manpages/lucid/en/man7/socket.7.html socket(7)], and the socket options that go with UDP are documented on [http://manpages.ubuntu.com/manpages/lucid/en/man7/udp.7.html udp(7)]. It's not especially helpful in this case, but it seems likely that the size of the send buffer would indeed limit the size of UDP packets if it were set to something less than the maximum packet size of 65507 bytes. This is not the case by default, but if it did happen, you could increase the size of the send buffer using socket_set_option() to allow the sending of full-sized packets. The PHP manual does not say that SOL_UDP exists, it says that only SOL_SOCKET exists, and that for any other protocols, you need to use the protocol number from getprotobyname(). Limiting packet size to 65535 bytes would not be correct, since the maximum UDP packet size is 65507 bytes, so any log entries between 65508 and 65535 bytes would still fail. See e.g. [[w:User Datagram Protocol#Packet structure]]. Krinkle has got it backwards: strlen() gives the size of the string in bytes, and mb_strlen() gives the size of the string in characters. strlen() is what you want. _______________________________________________ MediaWiki-CodeReview mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
