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 · 2 comments

Comments

Projects
3 participants
@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 label Dec 19, 2018

@sergeyklay sergeyklay removed the stale label Dec 19, 2018

@sergeyklay

This comment has been minimized.

Copy link
Member

sergeyklay commented Dec 19, 2018

@Ark4ne Could you please try latest stable Phalcon?

@phalcon phalcon deleted a comment from stale bot Dec 19, 2018

@niden niden added the Bug - Low label Dec 23, 2018

@niden niden self-assigned this Dec 23, 2018

@niden niden added this to To do in 4.0 Release via automation 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

@niden niden moved this from To do to In progress in 4.0 Release 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 added a commit to niden/cphalcon that referenced this issue Jan 5, 2019

[4.0.x] - Merge remote-tracking branch 'upstream/4.0.x' into 4.0.x
* upstream/4.0.x:
  Updated/Refactored Libmemcached tests
  phalcon#13459: Created test for issue and updated result checking
  Fixed phalcon#13497 returning "empty" values as `null`
@niden

This comment has been minimized.

Copy link
Member

niden commented Jan 19, 2019

Addressed

@niden niden closed this Jan 19, 2019

4.0 Release automation moved this from In progress to Done Jan 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment