#40037 [NEW]: Incorrect output from strtotime, when timestr is used with a relative term this

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40037 [NEW]: Incorrect output from strtotime, when timestr is used with a relative term this

    From: shruti224 at yahoo dot com
    Operating system: ES4
    PHP version: 5.2.0
    PHP Bug Type: Date/time related
    Bug description: Incorrect output from strtotime, when timestr is used with a relative term this

    Description:
    ------------
    Sample script to demonstrate the issue:

    <?php
    print "14:00:0 UTC this Friday [" . strtotime("14:00:0 UTC this Friday")
    .. "]\n";
    print "this Friday UTC [" . strtotime("this Friday UTC") . "]\n";
    print "now UTC from strtotime [" . strtotime("now UTC") . "]\n";
    ?>

    When I used this same script with :
    "PHP 5.0.5 (cli) (built: Oct 29 2006 22:42:15)
    Copyright (c) 1997-2004 The PHP Group
    Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies"

    and my System's date being:
    # date
    Fri Jan 5 14:21:38 EST 2007

    I got the correct desired output, which is as follows:

    14:00:0 UTC this Friday [1168005600]
    this Friday UTC [1167955200]
    now UTC from strtotime [1168006899]

    After upgrading to PHP 5.2
    "PHP 5.2.0 (cli) (built: Jan 2 2007 12:44:27)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies"

    and system's date now being

    # date
    Fri Jan 5 14:23:00 EST 2007

    The same script as above generated the following incorrect output:

    14:00:0 UTC this Friday [1167955200]
    this Friday UTC [1167955200]
    now UTC from strtotime [1168006981]

    By the look of it, it seems as if it ignores the time string completely.

    Please let me know, if I need to provide any further information.



    --
    Edit bug report at [url]http://bugs.php.net/?id=40037&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40037&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40037&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40037&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40037&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40037&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40037&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40037&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40037&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40037&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40037&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40037&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40037&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40037&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40037&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40037&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40037&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40037&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40037&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40037&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40037&r=mysqlcfg[/url]
    shruti224 at yahoo dot com Guest

  2. Similar Questions and Discussions

    1. #40003 [NEW]: strtotime(), incorrect results
      From: matt at iws dot co dot nz Operating system: Linux 2.4 PHP version: 5.2.0 PHP Bug Type: Date/time related Bug...
    2. #25981 [Opn->Bgs]: strtotime() returns incorrect date (near daylight saving time change)
      ID: 25981 Updated by: sniper@php.net Reported By: hazen at edsbits dot com -Status: Open +Status: ...
    3. #19166 [Dup->Bgs]: strtotime example in docs incorrect
      ID: 19166 Updated by: sniper@php.net Reported By: jc at mega-bucks dot co dot jp -Status: Duplicate +Status: ...
    4. #20382 [Com]: strtotime ("Monday", $date) can produce incorrect output
      ID: 20382 Comment by: pierre dot baudracco at aliacom dot fr Reported By: nickj-phpbugs at nickj dot org Status: ...
    5. #16517 [Dup->Csd]: strtotime no longer converts output of UNIX command 'date'
      ID: 16517 Updated by: sniper@php.net Reported By: joseph dot p dot weigel at aexp dot com -Status: Duplicate...
  3. #2

    Default #40037 [Opn]: Incorrect output from strtotime, when timestr is used with a relative term this

    ID: 40037
    User updated by: shruti224 at yahoo dot com
    Reported By: shruti224 at yahoo dot com
    Status: Open
    Bug Type: Date/time related
    Operating System: ES4
    PHP Version: 5.2.0
    New Comment:

    The following line in the sample script is used purely for
    demonstration purpose to give the idea to the developer of the test
    system's current time in UTC.

    print "now UTC from strtotime [" . strtotime("now UTC") . "]\n";

    The bug occurs when strtotime is invoked with a pattern containing
    timestr and a relative term ("this Friday") in my example.


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-01-05 19:30:19] shruti224 at yahoo dot com

    Description:
    ------------
    Sample script to demonstrate the issue:

    <?php
    print "14:00:0 UTC this Friday [" . strtotime("14:00:0 UTC this
    Friday") . "]\n";
    print "this Friday UTC [" . strtotime("this Friday UTC") . "]\n";
    print "now UTC from strtotime [" . strtotime("now UTC") . "]\n";
    ?>

    When I used this same script with :
    "PHP 5.0.5 (cli) (built: Oct 29 2006 22:42:15)
    Copyright (c) 1997-2004 The PHP Group
    Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies"

    and my System's date being:
    # date
    Fri Jan 5 14:21:38 EST 2007

    I got the correct desired output, which is as follows:

    14:00:0 UTC this Friday [1168005600]
    this Friday UTC [1167955200]
    now UTC from strtotime [1168006899]

    After upgrading to PHP 5.2
    "PHP 5.2.0 (cli) (built: Jan 2 2007 12:44:27)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies"

    and system's date now being

    # date
    Fri Jan 5 14:23:00 EST 2007

    The same script as above generated the following incorrect output:

    14:00:0 UTC this Friday [1167955200]
    this Friday UTC [1167955200]
    now UTC from strtotime [1168006981]

    By the look of it, it seems as if it ignores the time string
    completely.

    Please let me know, if I need to provide any further information.




    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40037&edit=1[/url]
    shruti224 at yahoo dot com Guest

  4. #3

    Default #40037 [Opn->Asn]: Incorrect output from strtotime, when timestr is used with a relative term this

    ID: 40037
    Updated by: [email]tony2001@php.net[/email]
    Reported By: shruti224 at yahoo dot com
    -Status: Open
    +Status: Assigned
    Bug Type: Date/time related
    Operating System: ES4
    PHP Version: 5.2.0
    -Assigned To:
    +Assigned To: derick


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-01-05 19:39:02] shruti224 at yahoo dot com

    The following line in the sample script is used purely for
    demonstration purpose to give the idea to the developer of the test
    system's current time in UTC.

    print "now UTC from strtotime [" . strtotime("now UTC") . "]\n";

    The bug occurs when strtotime is invoked with a pattern containing
    timestr and a relative term ("this Friday") in my example.

    ------------------------------------------------------------------------

    [2007-01-05 19:30:19] shruti224 at yahoo dot com

    Description:
    ------------
    Sample script to demonstrate the issue:

    <?php
    print "14:00:0 UTC this Friday [" . strtotime("14:00:0 UTC this
    Friday") . "]\n";
    print "this Friday UTC [" . strtotime("this Friday UTC") . "]\n";
    print "now UTC from strtotime [" . strtotime("now UTC") . "]\n";
    ?>

    When I used this same script with :
    "PHP 5.0.5 (cli) (built: Oct 29 2006 22:42:15)
    Copyright (c) 1997-2004 The PHP Group
    Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies"

    and my System's date being:
    # date
    Fri Jan 5 14:21:38 EST 2007

    I got the correct desired output, which is as follows:

    14:00:0 UTC this Friday [1168005600]
    this Friday UTC [1167955200]
    now UTC from strtotime [1168006899]

    After upgrading to PHP 5.2
    "PHP 5.2.0 (cli) (built: Jan 2 2007 12:44:27)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies"

    and system's date now being

    # date
    Fri Jan 5 14:23:00 EST 2007

    The same script as above generated the following incorrect output:

    14:00:0 UTC this Friday [1167955200]
    this Friday UTC [1167955200]
    now UTC from strtotime [1168006981]

    By the look of it, it seems as if it ignores the time string
    completely.

    Please let me know, if I need to provide any further information.




    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40037&edit=1[/url]
    tony2001@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139