|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14138 date arithmetic scrambled
Submitted: 2001-11-20 04:43 UTC Modified: 2001-11-23 06:13 UTC
From: mail-php dot net at kimihia dot org dot nz Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.6 OS: Debian GNU/Linux stable
Private report: No CVE-ID: None
 [2001-11-20 04:43 UTC] mail-php dot net at kimihia dot org dot nz
There seems to be some voodoo in this script ...

for ( $i = -7 ; $i < 28 ; $i ++ ) {
        $day = date('d');
        print "\ndate is $day ";
        $day = $day + $i;
        print " after adding $i is $day ";

And output ends up looking like so:

date is 20  after adding -7 is 135122101 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-20 04:47 UTC]
Works fine for me, can you try the RC from ?

 [2001-11-20 22:35 UTC]
Perhaps a problem with the Debian libraries, cannot confirm problem on PHP 4.0.6 under Solaris 2.8. Output of the code is correct in that machine and PHP version.

Code also tested by _RainMkr_ (from #php) using PHP 4.0.6 under Linux 2.4.5

Need feedback on whether other numeric programs have similar problems under that version of Debian.
 [2001-11-20 22:39 UTC]
More info from _RainMkr_: "Running on woody, Linux 2.4.5, PHP 4.0.6"

What version is the Debian showing this problem?
 [2001-11-20 23:03 UTC] mail-php dot net at kimihia dot org dot nz
Linux 2.4.12 SMP
Debian potato libraries

Package: libc5
Version: 5.4.46-3

Package: libc6
Version: 2.2.3-9

Package: libc6-dev
Version: 2.2.3-9

bc 1.05
Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
20 + -7

 [2001-11-23 05:56 UTC] mail-php dot net at kimihia dot org dot nz
Recompiled 4.1.0RC3 using Apache 1.3.22.

Yes, mathematics now works correctly. Haven't tested fully yet, but the first glance looks like it works.
 [2001-11-23 06:05 UTC]
Nice, closing this one.
 [2001-11-23 06:13 UTC] mail-php dot net at kimihia dot org dot nz
I'm curious, what do you think the problem was? libc6-dev and libc6 mismatch? I haven't kept a track of upgrades, although I believe libc6 hasn't been changed since long before Apache was compiled.

It also caused segfaults and other random wierdness in Apache.

The listed libc6 package (in previous report) isn't a current one on any Debian flavour.

potato: 2.1.3-19
woody: 2.2.4-5
If that sheds any light on the subject.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Jun 07 13:03:43 2023 UTC