Update Hash.php

I'm not sure on whether this is a problem with my local app but I have seen it a couple of times in a couple of projects: 
Warning (2): Invalid argument supplied for foreach() [CORE/Cake/Utility/Hash.php, line 52]

I think Hash::get should be able to handle this better rather than throwing an error in a core Util file.
I don't think PHP Warnings are the correct way to handle this error if the
user can affect it by simply passing a malformed argument to anything that
uses the Hash::get class, it should be more verbose, my error that caused
the above error message wasn't crucial but if it were then it should fire
an exception and halt execution rather than warning and carrying on IMO,
especially when this is called internally for things such as Session::read
:)


On 20 June 2014 20:44, Mark <notifications@github.com> wrote:

> In lib/Cake/Utility/Hash.php:
>
> > @@ -50,11 +50,14 @@ public static function get(array $data, $path, $default = null) {
> >  		} else {
> >  			$parts = $path;
> >  		}
> > -		foreach ($parts as $key) {
>
> I also think the additional exception might not be necessary
> it can only be @param string|array and in other cases the notice/error
> will notify the developer of wrong doing.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/cakephp/cakephp/pull/3754/files#r14014574>.
>



-- 
__
Mob: (+61) 0481 301 640
Skype: daniel.voyce
Twitter: www.twitter.com/voycey