1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 17:46:09 +02:00

mb_* functions with BC

This commit is contained in:
vershinin_so
2019-07-08 11:05:19 +03:00
parent ada57dd4a1
commit c79d81ec28
27 changed files with 120 additions and 64 deletions

View File

@@ -11,6 +11,8 @@
namespace Monolog\Handler\SyslogUdp;
use Monolog\Utils;
class UdpSocket
{
protected const DATAGRAM_MAX_LENGTH = 65023;
@@ -47,13 +49,13 @@ class UdpSocket
if (!is_resource($this->socket)) {
throw new \RuntimeException('The UdpSocket to '.$this->ip.':'.$this->port.' has been closed and can not be written to anymore');
}
socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port);
socket_sendto($this->socket, $chunk, Utils::strlen($chunk), $flags = 0, $this->ip, $this->port);
}
protected function assembleMessage(string $line, string $header): string
{
$chunkSize = static::DATAGRAM_MAX_LENGTH - strlen($header);
$chunkSize = static::DATAGRAM_MAX_LENGTH - Utils::strlen($header);
return $header . substr($line, 0, $chunkSize);
return $header . Utils::substr($line, 0, $chunkSize);
}
}