You might be able to get around this by creating a component to share
between the 2 controllers and putting the cookie code in there.

On Mon, Jul 6, 2009 at 11:09 PM, Jorgepedret<[email protected]> wrote:
>
> Hi,
>
> This is a slightly complicated case related (I think) to the guts of
> CakePHP. This is what I have:
>
> 1. A controller (Users) that uses Cookie as a component
> 2. There is a method in Users that uses the Cookie component to write
> a cookie
> 3. Another controller (MyAccount) non related to the Users controller
> 4. A method in MyAccount that app:imports the users controller and
> executes the method that uses the cookie (I'm using contructClasses in
> case you're wondering)
>
> Having this, I'm getting an error (from Security:cipher()) saying that
> the 'key' is empty, this key refers directly to the key value of the
> Cookie component. (Warning (512): You cannot use an empty key for
> Security::cipher() [ROOT\cake\libs\security.php, line 174]).
> Debugging, I confirmed that this key is not set for Cookie.
>
> Reviewing cakephp's guts, I found that:
>
> 1. Obviously the key is taken from the configuration security.salt key
> 2. The key is supposed to be set when Cookie::initialize($controller,
> $settings) is executed.
> 3. The component is not being initialized when I call App::import
> ('Controller','Users'), (having Cookie defined in the array of
> UsersController class).
>
> I could have fixed it defining manually the key everywhere I use it
> ($Users->Cookie->key = Configure::read('Security.salt')), but that
> looks really bad :S.
>
> I patched the component.php file from the cake/libs/controller/, but I
> want to know if anybody has found this issue, or if I'm doing
> something wrong.
>
> Thanks!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to