[geeklog-devel] Solution for Bug 0000853

Stan Palatnik yankees26an at gmail.com
Sat Apr 11 16:03:17 EDT 2009


Yea I didn't account for alphanumeric input using ctype. In that case, if
the text field contains any letters it should be run through *strtotime*().
It's a very flexible built-in php function that can detect alot of mixed
dates. For example it detects "yesterday", " one week ago", June 10th 2008",
etc.



On Sat, Apr 11, 2009 at 3:38 PM, Dirk Haun <dirk at haun-online.de> wrote:

> Stan Palatnik wrote:
>
> >The simplest fix is including checkdate() in both the start and end dates
> (...)
> >Another faster solution would be just to check if mkdate returns false
> >
> >                    $startdate = mktime(0,0,0,$DS[1],$DS[2],$DS[0]);
>
> Actually, when you crank up the error_reporting to E_ALL you already get
> an error for the mktime() call: "A non well formed numeric value
> encountered".
>
> I think the first thing we should be checking for is that the $DS and
> $DE arrays both have exactly 3 elements. And if the user mixed in some
> letters, both checkdate() and mktime() will barf again, so we may want
> to cast the 3 elements to (int) when calling any of those functions.
>
> Apart from that technicality, the real problem here is that this code
> exists in pretty much every plugin out there that implemented the search
> function ... And it doesn't look like the new search in 1.6.0 would
> change anything here. Sami?
>
> bye, Dirk
>
>
> --
> http://www.geeklog.net/
> http://geeklog.info/
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>



-- 
Warmly,

Stanislav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist8.pair.net/pipermail/geeklog-devel/attachments/20090411/a00e956b/attachment.html>


More information about the geeklog-devel mailing list