Bug or feature? - Beature
>> $data = ‘12345′
>> isset($data['foo']) ? ‘beature’ : ‘not set’
beature
I am just hacking away and just shrug. My AJAX request returns the following POST data data=[Object object]. Well, dojo obviously doesn’t resolve nested objects, so I get the ugly object string there. Ok, no problem.
But the interesting part here is that my PHP code behind expects an array and since I hadn’t implemented a type check the isset($data['foo']) returns true. What PHP does here (thanks to Alex Haslberger for the help figuring it out) is, it converts ‘foo’ into a 0 and uses the string $data to check if it has a character set at position 0. Which is true, of course.
I understand (don’t agree) that in PHP 1+’[’ returns 1, but the case above reveals that it might not be a good idea. Currently the type check has to be done by hand, which would be is_array() in my case, but is that really the right way?
I don’t feel like stressing my brain much more with it now, I am just too curious about our (Germany) quarter final game against Argentina … “don’t cry for me Argentina”
Krzysztof Kotowicz said,
June 30, 2006 at 3:40 pm
Interesting… For me it looks like a bug - why should it convert a associative array key to numeric?
Anyway, array_key_exists() should probably return correct result.
johanmaelson said,
July 1, 2006 at 9:53 am
$data = ‘12345′
isset($data[’foo’]) ? ‘beature’ : ‘not set’
Just open sometimes phpmanual :)))) it’s real simple to catch where is problem.
p.S Argentina play better then Germany. Anyways it’s a Germany WordCup so referys just give to your team advantage ….
And don’t say that i’m wrong i have eyes and i saw how you stupid Ballack trying to be an actRESS when he simulate, and just even haven’t any card for his actions
And stupid refery give an Argentin player yellow card for quaziSimulation.
Your Klose push out goalkeeper that’s why argentina loose penalty …
Just be happy while it’s your WorldCup.
p.S i always cheering for germany when they playing but not when it Argentina and now i know real Germany Face … LIERS “)))
Alexandria Melendez said,
July 26, 2011 at 11:14 pm
Excellent piece No wonder why Christian Dillstrom had a hyper link to your site - you must be doing a sweet job as mobile & social media marketing hot shot is pointing towards you!