php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65462 Please add tests for gregorian and jewish overflow fixes
Submitted: 2013-08-17 03:26 UTC Modified: 2016-07-28 18:23 UTC
From: neweracracker at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Calendar related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: neweracracker at gmail dot com
New email:
PHP Version: OS:

 

 [2013-08-17 03:26 UTC] neweracracker at gmail dot com
Description:
------------
While backporting calendar fixes from PHP 5.3 to PHP 5.2 I noticed that there are 
two fixes which lack of tests and I'd like to have more tests added.

Test script:
---------------
php -r "for ($i=324542840; $i<324542850; $i++) echo $i.':'.jdtojewish($i).PHP_EOL;"
324542840:12/7/887605
324542841:12/8/887605
324542842:12/9/887605
324542843:12/10/887605
324542844:12/11/887605
324542845:12/12/887605
324542846:12/13/887605
324542847:0/0/0
324542848:0/0/0
324542849:0/0/0

php -r "for ($i=536838860; $i<536838870; $i++) echo $i.':'.jdtogregorian($i).PHP_EOL;"
536838860:10/11/1465102
536838861:10/12/1465102
536838862:10/13/1465102
536838863:10/14/1465102
536838864:10/15/1465102
536838865:10/16/1465102
536838866:10/17/1465102
536838867:0/0/0
536838868:0/0/0
536838869:0/0/0


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-18 06:04 UTC] sixd@php.net
-Status: Open +Status: Feedback
 [2013-08-18 06:04 UTC] sixd@php.net
Can you construct these in PHP's .phpt test format?  See http://qa.php.net/write-
test.php and http://qa.php.net/phpt_details.php  Check existing tests to see how 
if anything special is required to make the tests run identically in all locales.
 [2013-08-19 15:53 UTC] neweracracker at gmail dot com
-Status: Feedback +Status: Open
 [2013-08-19 15:53 UTC] neweracracker at gmail dot com
--TEST--
Request #65462 (tests for gregorian and jewish overflow fixes)
--SKIPIF--
<?php
include 'skipif.inc';
?>
--FILE--
<?php
echo 'testing jdtojewish'."\n";
for ($i=324542840; $i<324542850; $i++) {
	echo $i.':'.jdtojewish($i)."\n";
}
echo 'done'."\n";
echo 'testing jdtogregorian'."\n";
for ($i=536838860; $i<536838870; $i++) {
	echo $i.':'.jdtogregorian($i)."\n";
}
echo 'done'."\n";
?>
--EXPECT--
testing jdtojewish
324542840:12/7/887605
324542841:12/8/887605
324542842:12/9/887605
324542843:12/10/887605
324542844:12/11/887605
324542845:12/12/887605
324542846:12/13/887605
324542847:0/0/0
324542848:0/0/0
324542849:0/0/0
done
testing jdtogregorian
536838860:10/11/1465102
536838861:10/12/1465102
536838862:10/13/1465102
536838863:10/14/1465102
536838864:10/15/1465102
536838865:10/16/1465102
536838866:10/17/1465102
536838867:0/0/0
536838868:0/0/0
536838869:0/0/0
done
 [2016-07-28 18:23 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2016-07-28 18:23 UTC] cmb@php.net
Thanks for the test! I've split it into two tests, because
jdtogregorian() overflows here for 32bit platforms only.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 06:01:31 2024 UTC