Skip to content

Incorrect read message #22

@Logioniz

Description

@Logioniz

Such code works wrong:

<?php

$loader = require __DIR__ . '/vendor/autoload.php';

$loop = React\EventLoop\Factory::create();

use \seregazhuk\React\Memcached\Factory;

$memcached = Factory::createClient($loop, '127.0.0.1:9003');

$memcached->set('key', "VALUE qwe 0 3\r\nqwe\r\nEND\r\nVALUE asd 0 3\r\asd\r\nEND\r\nVALUE zxc 0 3\r\zxc\r\nEND")
        ->then(function () use ($memcached) {
            return $memcached->get('key');
        })
        ->then(function ($data) use ($loop) {
            var_dump($data);
            $loop->stop();
        });

$loop->run();

From protocol specification:

Therefore, when a client retrieves
data from a server, it must use the length of the data block (which it
will be provided with) to determine where the data block ends, and not
the fact that \r\n follows the end of the data block, even though it
does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions