Looking at the stack trace, there was nothing that seemed to point to the 
cause of the problem. I'm at work now but I'll post a trace over the 
weekend. I use DebugKit from time to time, but it's usually off more often 
than not. I'll run it through DebugKit and see what I can come up with. The 
biggest mystery to me now is why did the error start "all of the sudden" 
and why for some users and not others. 

On Wednesday, February 27, 2013 1:45:29 PM UTC-5, CrotchFrog wrote:

> (Cake 2.2.5) I recently started getting an error that reads:
> Warning (2): Invalid argument supplied for foreach() 
> [CORE]/Cake/Utility/Hash.php, Line 50]
>
> Line 50 in Hash.php is part of get() function for the Hash class. Trying 
> to debug anything in that function results in a memory allocation error. 
> How is Hash being used and what kind of data is being presented to the 
> function that it's running out of memory? 
>
> There are only two users in the database at the moment and the error is 
> only showing for one of them. The method in my Users controller that seems 
> to be triggering the error is: 
>
> public function view($id = null){
>     
>        if ($id == null){
>            $id = $this->Auth->user('username');
>        }
>        $user = $this->User->getUser($id); 
>        $this->set(compact('user'));
>     }
>
> getUser() in the User model is: 
>
> public function getUser($id){
>          
> if (is_numeric($id)){ 
> $user = $this->find('first', array(
>             'conditions' => array(
>                 'User.id' => $id),
>             'contain' => array('Avatar', 'Bio', 'Role', 'Group')
>             )); 
> } else { 
> $user = $this->find('first', array(
>             'conditions' => array(
>                 'username' => $id),
>             'contain' => array('Avatar', 'Bio', 'Role', 'Group')
>             )); 
> }
>         if ($user){
>             return $user;
>         } return false; 
>     }
>
> Wondering what Hash is looking for and why it's reporting an error with 
> this particular method. The app has been running error free for quite some 
> time and I can't think of anything I changed that would have produced the 
> error. 
>
> Any help is appreciated. 
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to