Bug #71755 [NEW]: Invalid strtotime() result

From: Date: Wed, 09 Mar 2016 13:48:07 +0000
Subject: Bug #71755 [NEW]: Invalid strtotime() result
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199699@lists.php.net to get a copy of this message
From:             yoanrobin at free dot fr
Operating system: Windows 7 pro 64bits
PHP version:      Irrelevant
Package:          Date/time related
Bug Type:         Bug
Bug description:Invalid strtotime() result

Description:
------------
There is an issue with the strtotime() function.
http://php.net/manual/en/function.strtotime.php

The expression 'first day of this week' neither returns the expected
date nor the "false" value.
It will return different dates depending on the PHP version.

Sometimes, it's the "first day of this month", or the first day of the
previous month.


Test script:
---------------
echo date('Y-m-d H:i:s', strtotime('random invalid
expression'))."\r\n";
echo date('Y-m-d H:i:s', strtotime('first day of this month'))."\r\n";
echo date('Y-m-d H:i:s', strtotime('first day of this week'))."\r\n";

Expected result:
----------------
1970-01-01 01:00:00
2016-03-01 14:38:03
2016-03-07 14:38:03 // or 1970-01-01 01:00:00

Actual result:
--------------
1970-01-01 01:00:00
2016-03-01 14:38:03
2016-03-01 14:38:03

-- 
Edit bug report at https://bugs.php.net/bug.php?id=71755&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=71755&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=71755&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=71755&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=71755&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=71755&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=71755&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=71755&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=71755&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=71755&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=71755&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=71755&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=71755&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=71755&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71755&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=71755&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=71755&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=71755&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71755&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=71755&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=71755&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#199699) next »