php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51053 unixtojd unit test failure
Submitted: 2010-02-15 22:52 UTC Modified: 2012-12-20 07:53 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: seanius at debian dot org Assigned: sixd (profile)
Status: Closed Package: Calendar related
PHP Version: 5.3SVN-2010-02-16 (snap) OS: Debian
Private report: No CVE-ID: None
 [2010-02-15 22:52 UTC] seanius at debian dot org
Description:
------------
i don't know if this is a rounding problem or something else.  i can reproduce the problem on multiple architectures (32/64bit and BE/LE).

Note that i also found #28249 in which it was mentioned that the times are calculated based on noon, and can verify that subtracting a few hours from the second timestamp seems to get the test working. 

but since there's like 24 hours worth of timezones i guess any hardcoded value in the unit tests will probably fail somewhere :)  maybe some kind of dynamic addition/subtraction could be done based on the local timezone?

========TEST========
<?php
echo unixtojd(40000). "\n";
echo unixtojd(1000000000). "\n";
echo unixtojd(1152459009). "\n";
?>
========DONE========

========OUT========
2440588
2452162
2453926
========DONE========

========EXP========
2440588
2452161
2453926
========DONE========

========DIFF========
002+ 2452162
002- 2452161
========DONE========


Reproduce code:
---------------
ext/calendar/tests/unixtojd.phpt

Expected result:
----------------
PASS

Actual result:
--------------
FAIL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-15 23:00 UTC] seanius at debian dot org
oh and fwiw i'm GMT+1 atm
 [2010-02-16 08:44 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2010-02-16 09:03 UTC] seanius at debian dot org
(after a configure --enable-calendar --enable-cli && make)

rangda[/home/sean/Download/php5.3-201002160730] ./run-tests.php -p ./sapi/cli/php ext/calendar/tests/unixtojd.phpt 

=====================================================================
PHP         : ./sapi/cli/php 
PHP_SAPI    : cli
PHP_VERSION : 5.3.3-dev
ZEND_VERSION: 2.3.0
PHP_OS      : Linux - Linux rangda 2.6.32-trunk-amd64 #1 SMP Sun Jan 10 22:40:40 UTC 2010 x86_64
INI actual  : /home/sean/Download/php5.3-201002160730
More .INIs  :  
CWD         : /home/sean/Download/php5.3-201002160730
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
Running selected tests.
FAIL unixtojd() [ext/calendar/tests/unixtojd.phpt] 
=====================================================================
Number of tests :    1                 1
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (100.0%) (100.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      :    0 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
unixtojd() [ext/calendar/tests/unixtojd.phpt]
=====================================================================
 [2011-01-24 04:15 UTC] stas@php.net
-Package: Date/time related +Package: Calendar related
 [2011-09-26 21:14 UTC] sixd@php.net
-Status: Open +Status: Feedback
 [2012-12-20 07:03 UTC] aharvey@php.net
WFM. Let's call this fixed.
 [2012-12-20 07:03 UTC] aharvey@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: aharvey
 [2012-12-20 07:03 UTC] aharvey@php.net
-Assigned To: aharvey +Assigned To: sixd
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 19:01:28 2024 UTC