本文介绍了CakePHP Security :: cipher()没有专门在服务器上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在阅读encrpyted 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(第17行)
J WtJ0

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

  app / views / pages / home.ctp(line 17)$ b $bx .  9v   

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


解决方案

Security :: cipher()使用srand()函数,该函数被suhosin模块禁用, Apache,PHP服务器。



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


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
解决方案

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.

这篇关于CakePHP Security :: cipher()没有专门在服务器上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 20:38