Hi,

First my apologies for not being able to go a real reply to the real thread, 
but I just subscribed to the list a couple days ago (and the original thread 
subject was way too long anyway ;-)).

> > Boolean values are the only case where it is not possible to 
> > distinguish FALSE from invalid as they can be FALSE, but it is really 
> > not an issue.
> If it wasn't an issue I wouldn't have fixed it.

IMHO there's a more simple way to fix that without changing all the functions 
behavior. I think the distinction between NULL (non-existent data) and FALSE 
(invalid) should be kept and that having both cases return NULL, thus forcing 
users to use filter_has_var() to determine what this NULL means is a bit 
counter-intuitive.

A quite smaller modification of the boolean filter behavior could allow this 
(I'm sorry I can't send you a patch, but I'm a "PHP user" who hasn't touched 
a C source file for years... I'll try and do better next time if I can).

Make php_filter_boolean() return:
- (int)1 when the value is 1/on/true/yes
- (int)0 when the value is 0/off/false/no
- (bool)false when the value is something else

This is mostly backward compatible, as PHP considers that 0 == false and 1 == 
true, and would still allow people like Derick who'd need to make a 
difference between a "valid" boolean and an invalid value the possibility to 
do so by testing the returned value using ===.

Also, it would just require a small change in one single function, which I 
think would be more safe considering 5.2.0 is already an RC5.

Hoping I could be helpful,

skalpa.>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to