Re: potential PEAR::Validate bug
| From: | Stefan Neufeind | Date: | Tue, 20 Jan 2004 13:32:10 +0000 |
| Subject: | Re: potential PEAR::Validate bug | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10243@lists.php.net to get a copy of this message | ||
On Tue, 20 Jan 2004 at 13:17:30, Demian Turner wrote:
> I believe there may be a bug in Validate's uri method. When testing a string
> as
> a valid URI, if you don't pass the second optional $options array, the
> current
> code still checks for 'allowed_schemes' which hasn't been passed in options.
>
> Didn't find any relevant comments in pear-dev or the bugs database, attached
> is a patch which gets around the problem. Should I file this as a bug?
Well, this shouldn't be a problem in my eyes. You could also pass an array as
$options that doesn't contain an entry with the key "allowed_schemes" - you
don't check that in your solution as well. Maybe you are looking for something
like:
isset($allowed_schemes) && is_array($allowed_schemes)
But afaik the isset can be left out - since anything that's not set can't be an
array :-) Though I haven't tried an is_array on a variable that is not set.
Regards,
Stefan