When I moved my sites to a dedicated server from HostGator, several things were broken and all are broken involving type coercion. If $_POST[‘var’] is 0, it is not considered to be an integer and fails a comparison with another integer.
I went through and forced int types on all of those broken places on the site I found, but I’m sure there are more I didn’t find. I’m not crazy familiar with PHP.ini configuration, but perhaps you are and can tell me how I can fix this?
Thanks
No – you can’t change PHPs type conversion functionality, but you can write your code to better deal with PHP’s dynamic type conversion.
All request vars are automatically treated as strings. Without seeing your code it’s rather hard to establish what your criteria for “fails a comparison” are.
If I run:
Then I get
i.e. the only time the integer comparison fails is when I ask for a match on type as well as value.