CakePHP Security::cipher() is not working specifically on server

萝らか妹 提交于 2019-12-02 01:27:27

问题


I'm having a problem with reading the encrpyted cookie. Debugging revealed that Security::cipher() on server is somehow broken. Is there anyway I could solve it?

Below is the breakdown.

Code

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

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

Local

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

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

Server

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

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

回答1:


Security::cipher() is using srand() function which is disabled by suhosin module which comes as default for many Apache, PHP servers.

Disable suhosin and Security::cipher() will work fine.



来源:https://stackoverflow.com/questions/6087463/cakephp-securitycipher-is-not-working-specifically-on-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!