Home >Backend Development >PHP Tutorial >phpredis扩展调用lua脚本溢出问题

phpredis扩展调用lua脚本溢出问题

WBOY
WBOYOriginal
2016-06-06 20:20:381219browse

<code>$redis = new Redis();
$redis->connect('127.0.0.1');
$res = $redis->eval('return 32140378*16777216');
var_dump($res);
exit;
结果:1509949440
正确结果应该为:539226064027648
很明显有截断,溢出了,能确定是phpredis扩展的问题。求助大神</code>

回复内容:

<code>$redis = new Redis();
$redis->connect('127.0.0.1');
$res = $redis->eval('return 32140378*16777216');
var_dump($res);
exit;
结果:1509949440
正确结果应该为:539226064027648
很明显有截断,溢出了,能确定是phpredis扩展的问题。求助大神</code>

我自己已经修复了它,详情见:https://github.com/phpredis/phpredis/pull/721

看样子应该是 32bit64bit 切换的问题,看看你的机器是不是 32bit 的。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn