I can't explain this [solved]
Posted: Thu Nov 19, 2009 1:34 am
I have some code that runs as part of an automated test. When I run that code in browser I get E_NOTICE errors, I want to reproduce that behavior in test.
When I run this code in the test I get:
NULL NULL false int(0)
But no errors (I get errors on "line 2" if I run in the browser.)
If I put count( $foo) instead of the above code it does trigger an E_NOTICE error.
Hmm ok I figured it out but still posting anyways. Turns out
is Valid!
.. Where as..
Will blow up your application in your face
Code: Select all
var_dump( $this->value );
var_dump( $this->value['types'] );
var_dump( isset( $this->value['types'] ) );
var_dump( count( $this->value['types'] ) );
NULL NULL false int(0)
But no errors (I get errors on "line 2" if I run in the browser.)
If I put count( $foo) instead of the above code it does trigger an E_NOTICE error.
Hmm ok I figured it out but still posting anyways. Turns out
Code: Select all
$foo = null;
count( $foo['bar'] )
.. Where as..
Code: Select all
$foo = array();
count( $foo['bar'] )