mirror of
https://github.com/kevachat/npsapp.git
synced 2025-01-28 07:44:16 +00:00
make encoding validation on message enter
This commit is contained in:
parent
5427b135d5
commit
a4189b0a1f
@ -194,17 +194,6 @@ class Ratchet implements MessageComponentInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check message encoding valid
|
|
||||||
else if (!mb_check_encoding($connection->message, 'UTF-8'))
|
|
||||||
{
|
|
||||||
$connection->send(
|
|
||||||
implode(
|
|
||||||
PHP_EOL,
|
|
||||||
$config->response->submit->failure->encoding
|
|
||||||
) . PHP_EOL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Max length already checked on input, begin message save
|
// Max length already checked on input, begin message save
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -277,6 +266,19 @@ class Ratchet implements MessageComponentInterface
|
|||||||
// Complete message by new line sent
|
// Complete message by new line sent
|
||||||
$connection->message .= $request . PHP_EOL;
|
$connection->message .= $request . PHP_EOL;
|
||||||
|
|
||||||
|
// Check message encoding valid
|
||||||
|
if (!mb_check_encoding($connection->message, 'UTF-8'))
|
||||||
|
{
|
||||||
|
$connection->send(
|
||||||
|
implode(
|
||||||
|
PHP_EOL,
|
||||||
|
$config->response->submit->failure->encoding
|
||||||
|
) . PHP_EOL
|
||||||
|
);
|
||||||
|
|
||||||
|
$connection->close();
|
||||||
|
}
|
||||||
|
|
||||||
// Check total message length limit allowed by KevaCoin protocol
|
// Check total message length limit allowed by KevaCoin protocol
|
||||||
if (mb_strlen($connection->message) > 3074)
|
if (mb_strlen($connection->message) > 3074)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user