Re: Error Security::cipher()
I don't understand what you mean by "if ... call the function from an other controller it doesn't work..." -- are you accessing the function in your nonworking controller directly from a different controller? If so, you should be using requestAction() instead of calling the method directly. Anyway, here are some questions to ask yourself to help determine why it isn't working in the other controller: 1a) Have you globally searched your code for "Cookie->key" (i.e. $this- >Cookie->key)? You may have inadvertently set the value for this to null or blank as I indicated in my prior email. 1b) Have you verified that the initialization parameters for the CookieComponent in the nonworking controller (and any controller class(es) it is being extended from, such as the AppController). You may have inadvertently set the value for this to null or blank as I indicated in my prior email. 2) Are both the working and nonworking controllers in the same app? 3) Are both the working and nonworking controllers extending the same controller class (i.e. AppController, or is one extending a plugin app controller)? 4) Are either the working or nonworking controller implementing the beforeFilter() method? Are you calling parent::beforeFilter() within the method? On Mar 14, 3:06 am, Carachi wrote: > Thank you ShadowCross, > I do some other test and I discover that if I call the function from > URL it works and the Security::cipher() and the Security.salt is set , > but if I call the function from an other controller it doesn't work > and the Security.salt is set but the Security::cipher() is empty and > I don't understand Why... > I think that there is very strange! > > Thank you > Bye > > http://pcc8.netsons.org > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
Thank you ShadowCross, I do some other test and I discover that if I call the function from URL it works and the Security::cipher() and the Security.salt is set , but if I call the function from an other controller it doesn't work and the Security.salt is set but the Security::cipher() is empty and I don't understand Why... I think that there is very strange! Thank you Bye http://pcc8.netsons.org On 12 Mar, 08:35, ShadowCross wrote: > In your UsersController, try adding the following lines BEFORE you > execute $this->Cookie->write(): > > debug(Configure::read('Security.salt'); > debug($this->Cookie->key); > > The first line displays the default key that the CookieComponent uses > (usually defined in app/config/core.php), but the second line is the > actual value that Security::cipher() actually tries to use. > > If both debug values are blank, check your code for places where > Configure::write(Security.salt, ...) is being executed. If the first > debug value is not blank, but the second one is, check your > AppController and UsersController if you are overriding the default > value for $this->Cookie->key (either by using the > > var $components = array('Cookie' => array(...)); > > syntax, or by > > $this->Cookie->key = ...; > > On Mar 11, 2:12 am, Carachi wrote: > > > > > > > > > Hi cricket, > > I do this: > > > class UsersController extends AppController { > > > var $name = 'Users'; > > var $helper = array('Html','Form'); > > var $components = array('Cookie'); > > > function beforeFilter() { > > parent::beforeFilter(); > > $this->Auth->allow(array('login','build_acl')); > > } > > > function getUserFromCookies() { > > $name = 'user'; > > debug($name); //print user > > $this->Cookie->write($name, 'test' ,true); //print > > Warning (512): > > You cannot use an empty key for Security::cipher() > > $user = $this->Cookie->read($name); //print Warning > > (512): You > > cannot use an empty key for Security::cipher() > > return; > > } > > > } > > > in the other controller I use this functions to write and read > > > function setCookies($name, $value, $time = NULL) { > > $this->Cookie->write($name, $value ,true, $time); > > return; > > } > > > function getCookies($name) { > > return $this->Cookie->read($name); > > } > > > and this works! > > I don't understand why in the UsersController it doesn't works! > > > Thank you > > bye > > > On 10 Mar, 23:06, cricket wrote: > > > > On Thu, Mar 10, 2011 at 4:48 PM, Carachi wrote: > > > > Thank you. > > > > after set I call this method: > > > > $this->Cookie->read('mycookie'); > > > > and it return this error: > > > > Warning (512): You cannot use an empty key for > > > > Security::cipher() > > > > if I call with debug function so: > > > > debug($this->Cookie->read('mycookie')); > > > > doesn't return anything... > > > > No, we mean did you debug($name) to see that it's correct. In your > > > latest example, though, you're using a literal string. So, now you > > > need to ensure that $name == 'mycookie' in controller1. > > > > Perhaps a quicker way to handle this would be: > > > > $this->log($name); > > > $this->Cookie->write($name, $value ,true, $time); > > > > other controller: > > > $this->log($name); > > > $this->Cookie->read($name); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
In your UsersController, try adding the following lines BEFORE you execute $this->Cookie->write(): debug(Configure::read('Security.salt'); debug($this->Cookie->key); The first line displays the default key that the CookieComponent uses (usually defined in app/config/core.php), but the second line is the actual value that Security::cipher() actually tries to use. If both debug values are blank, check your code for places where Configure::write(Security.salt, ...) is being executed. If the first debug value is not blank, but the second one is, check your AppController and UsersController if you are overriding the default value for $this->Cookie->key (either by using the var $components= array('Cookie' => array(...)); syntax, or by $this->Cookie->key = ...; On Mar 11, 2:12 am, Carachi wrote: > Hi cricket, > I do this: > > class UsersController extends AppController { > > var $name = 'Users'; > var $helper = array('Html','Form'); > var $components = array('Cookie'); > > function beforeFilter() { > parent::beforeFilter(); > $this->Auth->allow(array('login','build_acl')); > } > > function getUserFromCookies() { > $name = 'user'; > debug($name); //print user > $this->Cookie->write($name, 'test' ,true); //print Warning > (512): > You cannot use an empty key for Security::cipher() > $user = $this->Cookie->read($name); //print Warning > (512): You > cannot use an empty key for Security::cipher() > return; > } > > } > > in the other controller I use this functions to write and read > > function setCookies($name, $value, $time = NULL) { > $this->Cookie->write($name, $value ,true, $time); > return; > } > > function getCookies($name) { > return $this->Cookie->read($name); > } > > and this works! > I don't understand why in the UsersController it doesn't works! > > Thank you > bye > > On 10 Mar, 23:06, cricket wrote: > > > > > On Thu, Mar 10, 2011 at 4:48 PM, Carachi wrote: > > > Thank you. > > > after set I call this method: > > > $this->Cookie->read('mycookie'); > > > and it return this error: > > > Warning (512): You cannot use an empty key for > > > Security::cipher() > > > if I call with debug function so: > > > debug($this->Cookie->read('mycookie')); > > > doesn't return anything... > > > No, we mean did you debug($name) to see that it's correct. In your > > latest example, though, you're using a literal string. So, now you > > need to ensure that $name == 'mycookie' in controller1. > > > Perhaps a quicker way to handle this would be: > > > $this->log($name); > > $this->Cookie->write($name, $value ,true, $time); > > > other controller: > > $this->log($name); > > $this->Cookie->read($name); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
Hi cricket, I do this: class UsersController extends AppController { var $name = 'Users'; var $helper = array('Html','Form'); var $components = array('Cookie'); function beforeFilter() { parent::beforeFilter(); $this->Auth->allow(array('login','build_acl')); } function getUserFromCookies() { $name = 'user'; debug($name); //print user $this->Cookie->write($name, 'test' ,true); //print Warning (512): You cannot use an empty key for Security::cipher() $user = $this->Cookie->read($name);//print Warning (512): You cannot use an empty key for Security::cipher() return; } } in the other controller I use this functions to write and read function setCookies($name, $value, $time = NULL) { $this->Cookie->write($name, $value ,true, $time); return; } function getCookies($name) { return $this->Cookie->read($name); } and this works! I don't understand why in the UsersController it doesn't works! Thank you bye On 10 Mar, 23:06, cricket wrote: > On Thu, Mar 10, 2011 at 4:48 PM, Carachi wrote: > > Thank you. > > after set I call this method: > > $this->Cookie->read('mycookie'); > > and it return this error: > > Warning (512): You cannot use an empty key for > > Security::cipher() > > if I call with debug function so: > > debug($this->Cookie->read('mycookie')); > > doesn't return anything... > > No, we mean did you debug($name) to see that it's correct. In your > latest example, though, you're using a literal string. So, now you > need to ensure that $name == 'mycookie' in controller1. > > Perhaps a quicker way to handle this would be: > > $this->log($name); > $this->Cookie->write($name, $value ,true, $time); > > other controller: > $this->log($name); > $this->Cookie->read($name); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
On Thu, Mar 10, 2011 at 4:48 PM, Carachi wrote: > Thank you. > after set I call this method: > $this->Cookie->read('mycookie'); > and it return this error: > Warning (512): You cannot use an empty key for > Security::cipher() > if I call with debug function so: > debug($this->Cookie->read('mycookie')); > doesn't return anything... No, we mean did you debug($name) to see that it's correct. In your latest example, though, you're using a literal string. So, now you need to ensure that $name == 'mycookie' in controller1. Perhaps a quicker way to handle this would be: $this->log($name); $this->Cookie->write($name, $value ,true, $time); other controller: $this->log($name); $this->Cookie->read($name); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
Thank you. after set I call this method: $this->Cookie->read('mycookie'); and it return this error: Warning (512): You cannot use an empty key for Security::cipher() if I call with debug function so: debug($this->Cookie->read('mycookie')); doesn't return anything... Thank you On Mar 10, 8:20 pm, cricket wrote: > On Thu, Mar 10, 2011 at 11:46 AM, Carachi wrote: > > thank you rethab > > I try with debug function but I didn't understand the problem. > > Cakephp give this error: > > > Warning (512): You cannot use an empty key for Security::cipher() > > [CORE/cake/libs/security.php, line 173] > > Code | Context > > function cipher($text, $key) { > > if (empty($key)) { > > trigger_error(__('You cannot use an empty key for > > Security::cipher()', true), E_USER_WARNING); > > > I don't understand how solve this problem! > > Did you debug the parameter? It's not clear that you did. > > debug($name); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
Thank you. after set I call this method: $this->Cookie->read('mycookie'); and it return this error: Warning (512): You cannot use an empty key for Security::cipher() if I call with debug function so: On Mar 10, 8:20 pm, cricket wrote: > On Thu, Mar 10, 2011 at 11:46 AM, Carachi wrote: > > thank you rethab > > I try with debug function but I didn't understand the problem. > > Cakephp give this error: > > > Warning (512): You cannot use an empty key for Security::cipher() > > [CORE/cake/libs/security.php, line 173] > > Code | Context > > function cipher($text, $key) { > > if (empty($key)) { > > trigger_error(__('You cannot use an empty key for > > Security::cipher()', true), E_USER_WARNING); > > > I don't understand how solve this problem! > > Did you debug the parameter? It's not clear that you did. > > debug($name); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
On Thu, Mar 10, 2011 at 11:46 AM, Carachi wrote: > thank you rethab > I try with debug function but I didn't understand the problem. > Cakephp give this error: > > > Warning (512): You cannot use an empty key for Security::cipher() > [CORE/cake/libs/security.php, line 173] > Code | Context > function cipher($text, $key) { > if (empty($key)) { > trigger_error(__('You cannot use an empty key for > Security::cipher()', true), E_USER_WARNING); > > > I don't understand how solve this problem! Did you debug the parameter? It's not clear that you did. debug($name); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
I'm really not into that stuff but did you make sure all your parameters are not empty? (that's what I suggested the debug function for) cheers On 10 Mrz., 17:46, Carachi wrote: > thank you rethab > I try with debug function but I didn't understand the problem. > Cakephp give this error: > > Warning (512): You cannot use an empty key for Security::cipher() > [CORE/cake/libs/security.php, line 173] > Code | Context > function cipher($text, $key) { > if (empty($key)) { > trigger_error(__('You cannot use an empty key for > Security::cipher()', true), E_USER_WARNING); > > I don't understand how solve this problem! > > Thank you > Bye > > On 10 Mar, 17:18, rethab wrote: > > > Hi you > > > I meant that one: debug($name); > > > Because it looks to me as if one of your parameters was empty > > > cheers > > > On 10 Mrz., 15:06, Carachi wrote: > > > > HI rethab > > > thank you. > > > How can I do function debug?? > > > > Thank you > > > > On 10 Mar, 13:00, rethab wrote: > > > > > have you checked what's the value of the parameters? e.g. by using the > > > > function debug > > > > > On 10 Mrz., 11:23, Carachi wrote: > > > > > > Hello, > > > > > I try to use the Cookie component but I have this problem: > > > > > I write the cookie in controller1 so: > > > > > $this->Cookie->write($name, $value ,true, $time); > > > > > and try to read this cookie from an other controller, controller2, so: > > > > > $this->Cookie->read($name); > > > > > > but when i call this function, cakephp return this error: > > > > > Warning (512): You cannot use an empty key for > > > > > Security::cipher() [CORE/cake/libs/security.php, line 173] > > > > > and I don't understand why, beacuse I use the same method to read in > > > > > the controller1 and works!! > > > > > > Thank you > > > > > Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
thank you rethab I try with debug function but I didn't understand the problem. Cakephp give this error: Warning (512): You cannot use an empty key for Security::cipher() [CORE/cake/libs/security.php, line 173] Code | Context function cipher($text, $key) { if (empty($key)) { trigger_error(__('You cannot use an empty key for Security::cipher()', true), E_USER_WARNING); I don't understand how solve this problem! Thank you Bye On 10 Mar, 17:18, rethab wrote: > Hi you > > I meant that one: debug($name); > > Because it looks to me as if one of your parameters was empty > > cheers > > On 10 Mrz., 15:06, Carachi wrote: > > > > > > > > > HI rethab > > thank you. > > How can I do function debug?? > > > Thank you > > > On 10 Mar, 13:00, rethab wrote: > > > > have you checked what's the value of the parameters? e.g. by using the > > > function debug > > > > On 10 Mrz., 11:23, Carachi wrote: > > > > > Hello, > > > > I try to use the Cookie component but I have this problem: > > > > I write the cookie in controller1 so: > > > > $this->Cookie->write($name, $value ,true, $time); > > > > and try to read this cookie from an other controller, controller2, so: > > > > $this->Cookie->read($name); > > > > > but when i call this function, cakephp return this error: > > > > Warning (512): You cannot use an empty key for > > > > Security::cipher() [CORE/cake/libs/security.php, line 173] > > > > and I don't understand why, beacuse I use the same method to read in > > > > the controller1 and works!! > > > > > Thank you > > > > Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
Hi you I meant that one: debug($name); Because it looks to me as if one of your parameters was empty cheers On 10 Mrz., 15:06, Carachi wrote: > HI rethab > thank you. > How can I do function debug?? > > Thank you > > On 10 Mar, 13:00, rethab wrote: > > > have you checked what's the value of the parameters? e.g. by using the > > function debug > > > On 10 Mrz., 11:23, Carachi wrote: > > > > Hello, > > > I try to use the Cookie component but I have this problem: > > > I write the cookie in controller1 so: > > > $this->Cookie->write($name, $value ,true, $time); > > > and try to read this cookie from an other controller, controller2, so: > > > $this->Cookie->read($name); > > > > but when i call this function, cakephp return this error: > > > Warning (512): You cannot use an empty key for > > > Security::cipher() [CORE/cake/libs/security.php, line 173] > > > and I don't understand why, beacuse I use the same method to read in > > > the controller1 and works!! > > > > Thank you > > > Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
HI rethab thank you. How can I do function debug?? Thank you On 10 Mar, 13:00, rethab wrote: > have you checked what's the value of the parameters? e.g. by using the > function debug > > On 10 Mrz., 11:23, Carachi wrote: > > > > > > > > > Hello, > > I try to use the Cookie component but I have this problem: > > I write the cookie in controller1 so: > > $this->Cookie->write($name, $value ,true, $time); > > and try to read this cookie from an other controller, controller2, so: > > $this->Cookie->read($name); > > > but when i call this function, cakephp return this error: > > Warning (512): You cannot use an empty key for > > Security::cipher() [CORE/cake/libs/security.php, line 173] > > and I don't understand why, beacuse I use the same method to read in > > the controller1 and works!! > > > Thank you > > Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Error Security::cipher()
have you checked what's the value of the parameters? e.g. by using the function debug On 10 Mrz., 11:23, Carachi wrote: > Hello, > I try to use the Cookie component but I have this problem: > I write the cookie in controller1 so: > $this->Cookie->write($name, $value ,true, $time); > and try to read this cookie from an other controller, controller2, so: > $this->Cookie->read($name); > > but when i call this function, cakephp return this error: > Warning (512): You cannot use an empty key for > Security::cipher() [CORE/cake/libs/security.php, line 173] > and I don't understand why, beacuse I use the same method to read in > the controller1 and works!! > > Thank you > Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Error Security::cipher()
Hello, I try to use the Cookie component but I have this problem: I write the cookie in controller1 so: $this->Cookie->write($name, $value ,true, $time); and try to read this cookie from an other controller, controller2, so: $this->Cookie->read($name); but when i call this function, cakephp return this error: Warning (512): You cannot use an empty key for Security::cipher() [CORE/cake/libs/security.php, line 173] and I don't understand why, beacuse I use the same method to read in the controller1 and works!! Thank you Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php