Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Libmemcached returns null, if the recovered data is empty #13497

Closed
Ark4ne opened this issue Sep 20, 2018 · 3 comments
Closed

[BUG] Libmemcached returns null, if the recovered data is empty #13497

Ark4ne opened this issue Sep 20, 2018 · 3 comments
Assignees
Labels
bug A bug report status: low Low

Comments

@Ark4ne
Copy link

Ark4ne commented Sep 20, 2018

Expected and Actual Behavior

Libmemcached returns null if the recovered data is empty.

Libmemcached should returns the data even if they empty.

Provide minimal script to reproduce the issue

<?php
$mc = new Memcached();

$mc->addServers(array(
    array('127.0.0.1',11211),
));

$lm = new \Phalcon\Cache\Backend\Libmemcached(new \Phalcon\Cache\Frontend\None(), [
    'servers' => [
        [
            'host' => '127.0.0.1',
            'port' => 11211,
            'weight' => 0,
        ],
    ]
]);

$array = [];

$lm->save('empty.array', $array, 1);

echo PHP_EOL . 'empty.array' . PHP_EOL;
echo 'libmemcached: ';
var_dump($lm->get('empty.array'));
echo 'memcached:    ';
var_dump($mc->get('empty.array'));


$lm->save('empty.int', 0, 1);

echo PHP_EOL . 'empty.int' . PHP_EOL;
echo 'libmemcached: ';
var_dump($lm->get('empty.int'));
echo 'memcached:    ';
var_dump($mc->get('empty.int'));


$lm->save('empty.string', '', 1);

echo PHP_EOL . 'empty.string' . PHP_EOL;
echo 'libmemcached: ';
var_dump($lm->get('empty.string'));
echo 'memcached:    ';
var_dump($mc->get('empty.string'));

$lm->save('empty.bool', false, 1);

echo PHP_EOL . 'empty.bool' . PHP_EOL;
echo 'libmemcached: ';
var_dump($lm->get('empty.bool'));
echo 'memcached:    ';
var_dump($mc->get('empty.bool'));

output

empty.array
libmemcached: NULL
memcached:    array(0) {
}

empty.int
libmemcached: NULL
memcached:    int(0)

empty.string
libmemcached: NULL
memcached:    string(0) ""

empty.bool
libmemcached: NULL
memcached:    bool(false)

Details

  • Phalcon version: 3.4.1
  • PHP Version: 7.2.9
  • Operating System: Debian 9
  • Installation type: package manager
  • Other related info :
  • memcached : 1.4.33
  • php_memcached : 3.0.4
@stale stale bot added the stale Stale issue - automatically closed label Dec 19, 2018
@sergeyklay sergeyklay removed the stale Stale issue - automatically closed label Dec 19, 2018
@sergeyklay
Copy link
Contributor

@Ark4ne Could you please try latest stable Phalcon?

@phalcon phalcon deleted a comment from stale bot Dec 19, 2018
@niden niden self-assigned this Dec 23, 2018
CameronHall added a commit to CameronHall/cphalcon that referenced this issue Dec 24, 2018
CameronHall added a commit to CameronHall/cphalcon that referenced this issue Dec 24, 2018
CameronHall added a commit to CameronHall/cphalcon that referenced this issue Dec 24, 2018
CameronHall added a commit to CameronHall/cphalcon that referenced this issue Dec 27, 2018
CameronHall added a commit to CameronHall/cphalcon that referenced this issue Jan 5, 2019
niden pushed a commit that referenced this issue Jan 5, 2019
@niden
Copy link
Member

niden commented Jan 19, 2019

Addressed

@niden niden closed this as completed Jan 19, 2019
@sergeyklay
Copy link
Contributor

Open please a separated issue

@niden niden added the 4.0 label Jun 21, 2019
@niden niden added bug A bug report status: low Low and removed Bug - Low labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
None yet
Development

No branches or pull requests

3 participants