Prev: problems with utf-8 conversion
Next: Logical reason for strtotime('east') and strtotime('west')returning valid results?
From: Colin Guthrie on 5 Apr 2010 13:39 Hi, Long time no speak! As part of a quick filter I'm writing I try to interpret free text strings as dates and textual data. Sometimes, this goes wrong. For example, I discovered that some words (or strings beginning with those words) will return false positives: e.g.: [colin(a)jimmy Search (working)]$ php -r 'var_dump(strtotime("east"));' int(1270514111) [colin(a)jimmy Search (working)]$ php -r 'var_dump(strtotime("west"));' int(1270488914) [colin(a)jimmy Search (working)]$ php -r 'var_dump(strtotime("now"));' int(1270488928) The last one is valid! But the other two appear to do much the same thing... Can anyone think of why this would be valid results before I report this to the relevant authorities? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
From: Colin Guthrie on 6 Apr 2010 12:16
'Twas brillig, and Kevin Kinsey at 05/04/10 19:15 did gyre and gimble: > Nonetheless, I'm suspecting the programmers had something > like this in mind. Yeah I guess that's why it interprets these terms. Good thinking :) > Isn't strtotime() based on some GNU utility? Yeah, that's why I said "the relevant authorities". I couldn't remember off-hand where it came from so figured I'd not blame "PHP" just yet :p Cheers Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] |