php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35456 function strtotime
Submitted: 2005-11-28 18:23 UTC Modified: 2005-11-29 00:12 UTC
From: webmaster at smiliz dot info Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.1.1 OS: Windows XP PRO
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: webmaster at smiliz dot info
New email:
PHP Version: OS:

 

 [2005-11-28 18:23 UTC] webmaster at smiliz dot info
Description:
------------
In PHP v5.1.1, strtotime() will parse days of the month with and ordinal suffix, in the format "+ 1 day", however this is no longer possible in PHP5.1.1 The same string without the ordinal suffix ("+ 1 day") returns a timestamp as expected.

Reproduce code:
---------------
<?php
// For exemple :
$duree_unite = "jours";
$duree_quantite = 1;

$duree_unite = str_replace("secondes","second",$duree_unite);
$duree_unite = str_replace("heures","hour",$duree_unite);
$duree_unite = str_replace("jours","day",$duree_unite);
$duree_unite = str_replace("semaines","week",$duree_unite);
$duree_unite = str_replace("mois","month",$duree_unite);
$duree_unite = str_replace("annee","year",$duree_unite);

$bandate     = strtotime("+ $duree_quantite $duree_unite");

echo $bandate;

?>

Expected result:
----------------
Both variables $duree_quantite and $duree_unite should contain, is empty and prints nothing.

Actual result:
--------------
is empty and prints nothing.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-28 18:33 UTC] webmaster at smiliz dot info
In PHP v5.0.5, this code will be run !
strtotime("+ $duree_quantite $duree_unite")

In PHP v5.1.1, strtotime("+ $duree_quantite $duree_unite")
is empty.

sorry for my bad description !
 [2005-11-28 19:03 UTC] tony2001@php.net
And var_dump("+ $duree_quantite $duree_unite"); gives you ... ?
 [2005-11-28 19:21 UTC] webmaster at smiliz dot info
test php5.1.1 :
var_dump("+ $duree_quantite $duree_unite"); 

result => string(7) "+ 1 day"
 [2005-11-28 19:25 UTC] tony2001@php.net
And what this code outputs for you?
<?php
var_dump(strtotime("+1 day"));
?>
 [2005-11-28 19:48 UTC] webmaster at smiliz dot info
test php 5.1.1 
var_dump(strtotime("+1 day"));
result => int(1133289924)

and test :
var_dump(strtotime("+ $duree_quantite $duree_unite"));
result => bool(false)
 [2005-11-28 20:08 UTC] tony2001@php.net
Assigned to the maintainer.
 [2005-11-29 00:12 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jan 31 07:01:30 2025 UTC