php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42361 strtotime() can't return any properly result
Submitted: 2007-08-21 14:08 UTC Modified: 2007-08-22 07:33 UTC
From: s679160 at yandex dot ru Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.3 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: s679160 at yandex dot ru
New email:
PHP Version: OS:

 

 [2007-08-21 14:08 UTC] s679160 at yandex dot ru
Description:
------------
Transfer bellow code form RH Linux 2.4.20-8smp+PHP 4.4.1 (cli) 
to RH Linux 2.6.18-8.1.4e15 + PHP 5.1.6 (cli) Zend 2.1.0

In the newer system strtotime() don't return ANY result (and error too).
In the older system strtotime() return needed value.

Is it strtotime problem or wrong algorythm ?


Excuse my poor English )

Reproduce code:
---------------
$base_day="2006-06-446";
echo "bd=$base_day\n";

$real_day=strtotime($base_day);
echo "may_be_error=".strtotime($base_day)."\n";

echo "rd1=$real_day\n";


Expected result:
----------------
In the 1st system (older) echo is:

bd=2006-06-446
may_be_error=1187557200
rd1=1187557200

Actual result:
--------------
In the 2nd system (newer) echo is:

bd=2006-06-446
may_be_error=
rd1=

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-21 14:14 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

2006-06-446 is clearly not a valid date.
 [2007-08-21 14:33 UTC] s679160 at yandex dot ru
So, but why function don't return error value (-1) ?
 [2007-08-21 14:55 UTC] derick@php.net
it returns false:

derick@kossu:~$ php -r 'var_dump(Strtotime("2006-06-446"));'
bool(false)

 [2007-08-22 06:27 UTC] s679160 at yandex dot ru
But in manual i see next:

if error occurs function return (-1). 

May be it is mistake in manual ?
 [2007-08-22 06:43 UTC] derick@php.net
No, it already says this (http://no.php.net/strtotime):

Return Values

Returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure. 
 [2007-08-22 07:33 UTC] s679160 at yandex dot ru
Thank you !

I find mistake. MY browser show russian help page usign your link and in the russian page present old version of return value. 
In newer russian CHM helpfile  too :(.

In newer English CHM helpfile all is OK.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 01:01:27 2024 UTC