2011-05-22 52 views
3

我在阅读加密cookie时遇到了问题。调试发现服务器上的Security :: cipher()不知何故中断。无论如何我可以解决它?CakePHP 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 

回答

0

安全::密码()使用srand()函数乐趣ction被suhosin模块禁用,该模块作为许多Apache,PHP服务器的默认模块。

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