#43960 [NEW]: strtotime() returns timestamp in the future when given a bogus string
| From: | chris dot corbyn at sitepoint dot com | Date: | Tue, 29 Jan 2008 05:29:03 +0000 |
| Subject: | #43960 [NEW]: strtotime() returns timestamp in the future when given a bogus string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-121697@lists.php.net to get a copy of this message | ||
From: chris dot corbyn at sitepoint dot com
Operating system: OS X/Linux
PHP version: 5.2.5
PHP Bug Type: Date/time related
Bug description: strtotime() returns timestamp in the future when given a bogus string
Description:
------------
When writing a unit test to ensure bogus data cannot be passed to our
e-commerce paypal request-response library we've stumbled upon an
unexpected problem. I enjoy the occassional (1-2 per day) slice whilst at
work so I passed this as a test bogus string.
<?php
var_dump(strtotime('i like to eat slices at work'));
?>
This returns a timestamp exactly 2 hours in the future. This has been
tested on 2 different macs and a linux server.
We've pinned it down to the "i". What we really expected was a boolean
false return value.
Reproduce code:
---------------
<?php
var_dump(strtotime('i like to eat slices at work'));
var_dump(strtotime('i')); //same
?>
Expected result:
----------------
A boolean FALSE return is expected.
Actual result:
--------------
An integer representing a UNIX timestamp exactly 2 hours in the future is
returned.
--
Edit bug report at http://bugs.php.net/?id=43960&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43960&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43960&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43960&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43960&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43960&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43960&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43960&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43960&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43960&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43960&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43960&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43960&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43960&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43960&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43960&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43960&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43960&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43960&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43960&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43960&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43960&r=mysqlcfg