Bug #52798 [Com]: dateTime => function diff => days KO
| From: | kissifrot at gmail dot com | Date: | Fri, 24 Feb 2012 17:51:52 +0000 |
| Subject: | Bug #52798 [Com]: dateTime => function diff => days KO | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167799@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52798&edit=1
ID: 52798
Comment by: kissifrot at gmail dot com
Reported by: ebinachon at pierre-vacances dot fr
Summary: dateTime => function diff => days KO
Status: Feedback
Type: Bug
Package: Date/time related
Operating System: windows xp
PHP Version: 5.3.3
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Reproduced on PHP Win32 5.3.10 VC6, but not the VC9.
Previous Comments:
------------------------------------------------------------------------
[2011-01-30 11:22:53] stas@php.net
Also, please try vc9 build.
------------------------------------------------------------------------
[2011-01-30 10:49:36] stas@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Works fine for me with current SVN 5.3 HEAD.
------------------------------------------------------------------------
[2010-09-08 18:12:46] cataphract@php.net
The problem was the call to floor().
The compiler gave a warning:
"d:\users\cataphract\documents\php-trunk\ext\date\lib\interval.c(57) : warning C4013:
'floor' undefined; assuming extern returning int"
The assumption is wrong, because it calls
double __cdecl floor(_In_ double _X);
Which takes and returns a larger type.
I removed the call to floor, which is unnecessary since it's an integer division.
I also changed the call to abs to a call to llabs to avoid the conversion from long long to int and
then to long long again.
------------------------------------------------------------------------
[2010-09-08 18:03:46] cataphract@php.net
The following patch has been added/updated:
Patch Name: date_diff
Revision: 1283961826
URL: http://bugs.php.net/patch-display.php?bug=52798&patch=date_diff&revision=1283961826
------------------------------------------------------------------------
[2010-09-08 17:36:02] cataphract@php.net
I can reproduce only on Windows. The exactly value varies (seems to be garbage memory).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=52798
--
Edit this bug report at https://bugs.php.net/bug.php?id=52798&edit=1