【问题标题】:CakePHP Security::cipher() is not working specifically on serverCakePHP Security::cipher() 不是专门在服务器上工作
【发布时间】:2011-08-30 13:21:09
【问题描述】:

我在读取加密 cookie 时遇到问题。调试显示服务器上的 Security::cipher() 以某种方式损坏。有没有办法解决?

下面是细目。

代码

$value = "Hello World";
$key = Configure::read('Security.salt');

$val = Security::cipher($value, $key);
debug($val);
$ret = Security::cipher($val, $key);
debug($ret);

本地

app\views\pages\home.ctp (line 17)
�J��WtJ0�

app\views\pages\home.ctp (line 19)
Hello World

服务器

app/views/pages/home.ctp (line 17)
x�.��9v��

app/views/pages/home.ctp (line 19)
�{�U��g��O

【问题讨论】:

    标签: php security cakephp lamp cakephp-1.2


    【解决方案1】:

    Security::cipher() 正在使用 srand() 函数,该函数被 suhosin 模块禁用,该模块是许多 Apache、PHP 服务器的默认设置。

    禁用 suhosin 和 Security::cipher() 将正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-18
      • 2012-02-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多