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

Not work with gzuncompress on php7 #827

Closed
vus520 opened this issue Jun 8, 2016 · 5 comments
Closed

Not work with gzuncompress on php7 #827

vus520 opened this issue Jun 8, 2016 · 5 comments

Comments

@vus520
Copy link

vus520 commented Jun 8, 2016

maybe this is a php's bug, I don't know. on php 5.6 is very well.

<?php

$array = ["a"=>"b", "c"=>"d"];

$redis = new redis();
$redis->connect('127.0.0.1', 6379);

$set = $redis->set("json_encode", json_encode($array));
var_dump($set);

$get = $redis->get("json_encode");
var_dump($get);

$set = $redis->set("gzcompress", gzcompress(json_encode($array)));
var_dump($set);

$get = $redis->get("gzcompress");
var_dump(gzuncompress($get));
[root@kt53 ~]# php redis-gz.php
bool(true)
string(17) "{"a":"b","c":"d"}"
bool(true)
string(17) "{"a":"b","c":"d"}"
[root@kt53 ~]# php -v
PHP 5.6.22 (cli) (built: May 28 2016 10:12:12)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
[root@kt53 ~]# php7 redis-gz.php
bool(true)
string(17) "{"a":"b","c":"d"}"
bool(true)

Warning: gzuncompress(): data error in /root/redis-gz.php on line 18
bool(false)
[root@kt53 ~]# php7 -v
PHP 7.0.7 (cli) (built: Jun  3 2016 11:33:56) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
@vus520
Copy link
Author

vus520 commented Jun 8, 2016

Now i checked some case on php7. it's working fine.


$compressed   = gzcompress('Compress me', 9);
$uncompressed = gzuncompress($compressed);
echo $uncompressed;

$compressed   = gzdeflate('Compress me', 9);
$uncompressed = gzinflate($compressed);
echo $uncompressed;

So, any help?

@michael-grunder
Copy link
Member

Hey,

I'm not sure to be honest. I ran it in 5.5.29, 5.5.13, and 7.0.0 and they all worked fine. I think I've got an old 5.3 version somewhere. I'll try to test it there as well.

Cheers
Mike

@vus520
Copy link
Author

vus520 commented Jun 30, 2016

@michael-grunder

Hi, do you have any progress on this issue?
Or Plan?

@vus520
Copy link
Author

vus520 commented Feb 21, 2017

This bug solved, Finally.

@michael-grunder

[root@dfbff1abc1de redis_test]#php phpredis.php
php version 7.0.15 phpredis version 3.1.0
bool(true)
string(17) "{"a":"b","c":"d"}"
bool(true)
string(17) "{"a":"b","c":"d"}"
[root@dfbff1abc1de redis_test]# php phpredis.php
php version 7.1.1 phpredis version 3.1.0
bool(true)
string(17) "{"a":"b","c":"d"}"
bool(true)
string(17) "{"a":"b","c":"d"}"

@vus520 vus520 closed this as completed Feb 21, 2017
@noprom
Copy link

noprom commented Feb 21, 2017

Awesome~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants