[wp-hackers] DOING_AJAX all the time
steve at sltaylor.co.uk
Wed Feb 1 20:40:09 UTC 2012
Well I'll be... Thanks for the info Otto!
On 1 February 2012 04:23, Otto <otto at ottodestruct.com> wrote:
> On Tue, Jan 31, 2012 at 5:30 PM, Steve Taylor <steve at sltaylor.co.uk> wrote:
>> Duh - thanks!
>> I always used to think that was a dodgy behaviour for constants (to
>> return true when not defined). Then I forgot about it and they bit me
> They don't return true when undefined, actually; they return strings.
> It's just PHP making assumptions for you again.
> Any undefined constant used like that is assumed to actually be an
> unquoted static string. If you turn PHP Notices and error reporting
> on, you'll see a message like this:
> Notice: Use of undefined constant WHATEVER - assumed 'WHATEVER' in
> script.php on line 123
> Basically it's evaluating that constant as the string instead. And any
> string except the empty string is equivalent to "true" when used as a
> boolean expression. So, there you go.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers