derick Wed, 07 Dec 2011 19:24:58 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=320604
Log: Sorting out the tests *once* more. Please keep them consistent and only change them if you are 110% certain what you're doing. Otherwise -> please ask. Changed paths: U php/php-src/branches/PHP_5_3/ext/date/tests/bug28088.phpt U php/php-src/branches/PHP_5_3/ext/date/tests/bug33415-2.phpt D php/php-src/branches/PHP_5_3/ext/date/tests/bug51223.phpt A php/php-src/branches/PHP_5_3/ext/date/tests/bug52062-64bit.phpt U php/php-src/branches/PHP_5_3/ext/date/tests/bug52062.phpt A + php/php-src/branches/PHP_5_3/ext/date/tests/bug52113.phpt (from php/php-src/branches/PHP_5_3/ext/date/tests/bug51223.phpt:r320599) U php/php-src/branches/PHP_5_3/ext/date/tests/bug53502.phpt U php/php-src/branches/PHP_5_3/ext/date/tests/gmstrftime_variation22.phpt U php/php-src/branches/PHP_5_3/ext/date/tests/strftime_variation22.phpt U php/php-src/branches/PHP_5_4/ext/date/tests/DateInterval_format.phpt A php/php-src/branches/PHP_5_4/ext/date/tests/DateInterval_format_a.phpt A php/php-src/branches/PHP_5_4/ext/date/tests/bug52062-64bit.phpt U php/php-src/branches/PHP_5_4/ext/date/tests/bug52062.phpt U php/php-src/branches/PHP_5_4/ext/date/tests/bug53502.phpt U php/php-src/branches/PHP_5_4/ext/date/tests/date_default_timezone_set-1.phpt U php/php-src/trunk/ext/date/tests/DateInterval_format.phpt A php/php-src/trunk/ext/date/tests/DateInterval_format_a.phpt A php/php-src/trunk/ext/date/tests/bug52062-64bit.phpt U php/php-src/trunk/ext/date/tests/bug52062.phpt U php/php-src/trunk/ext/date/tests/bug53502.phpt
Modified: php/php-src/branches/PHP_5_3/ext/date/tests/bug28088.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug28088.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug28088.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,9 +1,9 @@ --TEST-- Bug #28088 (strtotime() cannot convert 00 hours") +--INI-- +date.timezone=UTC --FILE-- <?php -putenv("TZ=GMT"); - echo "The following line rightly shows the correct date time:\n"; echo gmdate("m/d/y Hi", strtotime("04/04/04 2345")), "\n"; Modified: php/php-src/branches/PHP_5_3/ext/date/tests/bug33415-2.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug33415-2.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug33415-2.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -2,14 +2,10 @@ Bug #33415 [2] (Possibly invalid non-one-hour DST or timezone shifts) --FILE-- <?php +date_default_timezone_set('Africa/Bujumbura'); print "TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Africa/Bujumbura'); -} else { - putenv("TZ=Africa/Bujumbura"); -} $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Wednesday", $tStamp); @@ -17,11 +13,7 @@ print "wanted=Wednesday 00:00:00\n\n"; print "TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Asia/Thimbu'); -} else { - putenv("TZ=Asia/Thimbu"); -} +date_default_timezone_set('Asia/Thimbu'); $tStamp = mktime (17, 17, 17, 1, 6476, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -30,11 +22,7 @@ print "TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Indian/Cocos'); -} else { - putenv("TZ=Indian/Cocos"); -} +date_default_timezone_set('Indian/Cocos'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -43,11 +31,7 @@ print "TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Africa/Lubumbashi'); -} else { - putenv("TZ=Africa/Lubumbashi"); -} +date_default_timezone_set('Africa/Lubumbashi'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Saturday", $tStamp); @@ -55,11 +39,7 @@ print "wanted=Saturday 00:00:00\n\n"; print "TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Asia/Kashgar'); -} else { - putenv("TZ=Asia/Kashgar"); -} +date_default_timezone_set('Asia/Kashgar'); $tStamp = mktime (17, 17, 17, 1, 3767, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -68,11 +48,7 @@ print "TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Indian/Christmas'); -} else { - putenv("TZ=Indian/Christmas"); -} +date_default_timezone_set('Indian/Christmas'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Sunday", $tStamp); @@ -80,11 +56,7 @@ print "wanted=Sunday 00:00:00\n\n"; print "TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('America/Santo_Domingo'); -} else { - putenv("TZ=America/Santo_Domingo"); -} +date_default_timezone_set('America/Santo_Domingo'); $tStamp = mktime (17, 17, 17, 1, 291, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Sunday", $tStamp); @@ -93,11 +65,7 @@ print "TZ=Pacific/Truk - Is it OK for this to be 10 AM? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Truk'); -} else { - putenv("TZ=Pacific/Truk"); -} +date_default_timezone_set('Pacific/Truk'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -106,11 +74,7 @@ print "TZ=Pacific/Ponape - Is it OK for this to be 11 AM? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Ponape'); -} else { - putenv("TZ=Pacific/Ponape"); -} +date_default_timezone_set('Pacific/Ponape'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Monday", $tStamp); @@ -118,11 +82,7 @@ print "wanted=Monday 00:00:00\n\n"; print "TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('America/Scoresbysund'); -} else { - putenv("TZ=America/Scoresbysund"); -} +date_default_timezone_set('America/Scoresbysund'); $tStamp = mktime (17, 17, 17, 1, 4099, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Sunday", $tStamp); @@ -130,11 +90,7 @@ print "wanted=Sunday 02:00:00\n\n"; print "TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('America/Guyana'); -} else { - putenv("TZ=America/Guyana"); -} +date_default_timezone_set('America/Guyana'); $tStamp = mktime (17, 17, 17, 1, 2031, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -142,11 +98,7 @@ print "wanted=Thursday 00:45:00\n\n"; print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Asia/Tehran'); -} else { - putenv("TZ=Asia/Tehran"); -} +date_default_timezone_set('Asia/Tehran'); $tStamp = mktime (17, 17, 17, 1, 2855, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -155,11 +107,7 @@ print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Tarawa'); -} else { - putenv("TZ=Pacific/Tarawa"); -} +date_default_timezone_set('Pacific/Tarawa'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Monday", $tStamp); @@ -167,11 +115,7 @@ print "wanted=Monday 00:00:00\n\n"; print "TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Africa/Monrovia'); -} else { - putenv("TZ=Africa/Monrovia"); -} +date_default_timezone_set('Africa/Monrovia'); $tStamp = mktime (17, 17, 17, 1, 845, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Monday", $tStamp); @@ -179,11 +123,7 @@ print "wanted=Monday 00:44:30\n\n"; print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Asia/Katmandu'); -} else { - putenv("TZ=Asia/Katmandu"); -} +date_default_timezone_set('Asia/Katmandu'); $tStamp = mktime (17, 17, 17, 1, 5838, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Wednesday", $tStamp); @@ -191,11 +131,7 @@ print "wanted=Wednesday 00:15:00\n\n"; print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Nauru'); -} else { - putenv("TZ=Pacific/Nauru"); -} +date_default_timezone_set('Pacific/Nauru'); $tStamp = mktime (17, 17, 17, 1, 3401, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -203,11 +139,7 @@ print "wanted=Tuesday 00:30:00\n\n"; print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Niue'); -} else { - putenv("TZ=Pacific/Niue"); -} +date_default_timezone_set('Pacific/Niue'); $tStamp = mktime (17, 17, 17, 1, 3189, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Sunday", $tStamp); @@ -216,11 +148,7 @@ print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Port_Moresby'); -} else { - putenv("TZ=Pacific/Port_Moresby"); -} +date_default_timezone_set('Pacific/Port_Moresby'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -228,11 +156,7 @@ print "wanted=Thursday 00:00:00\n\n"; print "TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('America/Miquelon'); -} else { - putenv("TZ=America/Miquelon"); -} +date_default_timezone_set('America/Miquelon'); $tStamp = mktime (17, 17, 17, 1, 3767, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -241,11 +165,7 @@ print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Palau'); -} else { - putenv("TZ=Pacific/Palau"); -} +date_default_timezone_set('Pacific/Palau'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Saturday", $tStamp); @@ -254,11 +174,7 @@ print "TZ=Pacific/Funafuti - Is it OK for this to be midday? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Funafuti'); -} else { - putenv("TZ=Pacific/Funafuti"); -} +date_default_timezone_set('Pacific/Funafuti'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Wednesday", $tStamp); @@ -267,11 +183,7 @@ print "TZ=Pacific/Wake - Is it OK for this to be midday? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Wake'); -} else { - putenv("TZ=Pacific/Wake"); -} +date_default_timezone_set('Pacific/Wake'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -280,11 +192,7 @@ print "TZ=Pacific/Wallis - Is it OK for this to be midday? Note: does not appear to have a DST or timezone transition.\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('Pacific/Wallis'); -} else { - putenv("TZ=Pacific/Wallis"); -} +date_default_timezone_set('Pacific/Wallis'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -292,11 +200,7 @@ print "wanted=Tuesday 00:00:00\n\n"; print "TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes\n"; -if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - date_default_timezone_set('America/Paramaribo'); -} else { - putenv("TZ=America/Paramaribo"); -} +date_default_timezone_set('America/Paramaribo'); $tStamp = mktime (17, 17, 17, 1, 5381, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Monday", $tStamp); Deleted: php/php-src/branches/PHP_5_3/ext/date/tests/bug51223.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug51223.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug51223.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,100 +0,0 @@ ---TEST-- -Bug #52113: Seg fault while creating (by unserialization) DatePeriod ---FILE-- -<?php -$start = new DateTime('2003-01-02 08:00:00'); -$end = new DateTime('2003-01-02 12:00:00'); -$diff = $start->diff($end); -$p = new DatePeriod($start, $diff, 2); -$diff_s = serialize($diff); -var_dump($diff, $diff_s); -var_export($diff); - -$diff_un = unserialize($diff_s); -$p = new DatePeriod($start, $diff_un, 2); -var_dump($diff_un, $p); - -$unser = DateInterval::__set_state(array( - 'y' => 7, - 'm' => 6, - 'd' => 5, - 'h' => 4, - 'i' => 3, - 's' => 2, - 'invert' => 1, - 'days' => 2400, -)); - -$p = new DatePeriod($start, $diff_un, 2); -var_dump($unser, $p); - -?> ---EXPECT-- -object(DateInterval)#3 (8) { - ["y"]=> - int(0) - ["m"]=> - int(0) - ["d"]=> - int(0) - ["h"]=> - int(4) - ["i"]=> - int(0) - ["s"]=> - int(0) - ["invert"]=> - int(0) - ["days"]=> - int(0) -} -string(128) "O:12:"DateInterval":8:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:6:"invert";i:0;s:4:"days";i:0;}" -DateInterval::__set_state(array( - 'y' => 0, - 'm' => 0, - 'd' => 0, - 'h' => 4, - 'i' => 0, - 's' => 0, - 'invert' => 0, - 'days' => 0, -))object(DateInterval)#5 (8) { - ["y"]=> - int(0) - ["m"]=> - int(0) - ["d"]=> - int(0) - ["h"]=> - int(4) - ["i"]=> - int(0) - ["s"]=> - int(0) - ["invert"]=> - int(0) - ["days"]=> - int(0) -} -object(DatePeriod)#6 (0) { -} -object(DateInterval)#4 (8) { - ["y"]=> - int(7) - ["m"]=> - int(6) - ["d"]=> - int(5) - ["h"]=> - int(4) - ["i"]=> - int(3) - ["s"]=> - int(2) - ["invert"]=> - int(1) - ["days"]=> - int(2400) -} -object(DatePeriod)#7 (0) { -} Added: php/php-src/branches/PHP_5_3/ext/date/tests/bug52062-64bit.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug52062-64bit.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug52062-64bit.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -0,0 +1,27 @@ +--TEST-- +Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp (64 bit) +--SKIPIF-- +<?php +if (PHP_INT_SIZE == 4) die('skip 64 bit only'); +?> +--INI-- +date.timezone=UTC +--FILE-- +<?php +$d = new DateTime('@100000000000'); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$d->setTimestamp(100000000000); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$i = new DateInterval('PT100000000000S'); +var_dump($i->format('%s')); +?> +--EXPECT-- +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(12) "100000000000" Modified: php/php-src/branches/PHP_5_3/ext/date/tests/bug52062.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug52062.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug52062.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,5 +1,11 @@ --TEST-- -Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp +Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp (32 bit) +--SKIPIF-- +<?php +if (PHP_INT_SIZE == 8) die('skip 32-bit only'); +?> +--INI-- +date.timezone=UTC --FILE-- <?php $d = new DateTime('@100000000000'); Copied: php/php-src/branches/PHP_5_3/ext/date/tests/bug52113.phpt (from rev 320599, php/php-src/branches/PHP_5_3/ext/date/tests/bug51223.phpt) =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug52113.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug52113.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -0,0 +1,102 @@ +--TEST-- +Bug #52113: Seg fault while creating (by unserialization) DatePeriod +--INI-- +date.timezone=UTC +--FILE-- +<?php +$start = new DateTime('2003-01-02 08:00:00'); +$end = new DateTime('2003-01-02 12:00:00'); +$diff = $start->diff($end); +$p = new DatePeriod($start, $diff, 2); +$diff_s = serialize($diff); +var_dump($diff, $diff_s); +var_export($diff); + +$diff_un = unserialize($diff_s); +$p = new DatePeriod($start, $diff_un, 2); +var_dump($diff_un, $p); + +$unser = DateInterval::__set_state(array( + 'y' => 7, + 'm' => 6, + 'd' => 5, + 'h' => 4, + 'i' => 3, + 's' => 2, + 'invert' => 1, + 'days' => 2400, +)); + +$p = new DatePeriod($start, $diff_un, 2); +var_dump($unser, $p); + +?> +--EXPECT-- +object(DateInterval)#3 (8) { + ["y"]=> + int(0) + ["m"]=> + int(0) + ["d"]=> + int(0) + ["h"]=> + int(4) + ["i"]=> + int(0) + ["s"]=> + int(0) + ["invert"]=> + int(0) + ["days"]=> + int(0) +} +string(128) "O:12:"DateInterval":8:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:6:"invert";i:0;s:4:"days";i:0;}" +DateInterval::__set_state(array( + 'y' => 0, + 'm' => 0, + 'd' => 0, + 'h' => 4, + 'i' => 0, + 's' => 0, + 'invert' => 0, + 'days' => 0, +))object(DateInterval)#5 (8) { + ["y"]=> + int(0) + ["m"]=> + int(0) + ["d"]=> + int(0) + ["h"]=> + int(4) + ["i"]=> + int(0) + ["s"]=> + int(0) + ["invert"]=> + int(0) + ["days"]=> + int(0) +} +object(DatePeriod)#6 (0) { +} +object(DateInterval)#4 (8) { + ["y"]=> + int(7) + ["m"]=> + int(6) + ["d"]=> + int(5) + ["h"]=> + int(4) + ["i"]=> + int(3) + ["s"]=> + int(2) + ["invert"]=> + int(1) + ["days"]=> + int(2400) +} +object(DatePeriod)#7 (0) { +} Modified: php/php-src/branches/PHP_5_3/ext/date/tests/bug53502.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug53502.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug53502.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,5 +1,7 @@ --TEST-- Bug #53502: strtotime with timezone memory leak +--INI-- +date.timezone=UTC --FILE-- <?php for ($i = 0; $i < 1000; $i++) { Modified: php/php-src/branches/PHP_5_3/ext/date/tests/gmstrftime_variation22.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/gmstrftime_variation22.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_3/ext/date/tests/gmstrftime_variation22.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -5,8 +5,8 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { die("skip Test is not valid for Windows"); } -if (!setlocale(LC_ALL, "en_US.utf8", "en_US")) { - die("skip Locale en_US or en_US.utf8 is required to run this test"); +if (!setlocale(LC_TIME, "POSIX")) { + die("skip Locale POSIX is required to run this test"); } ?> --FILE-- @@ -21,7 +21,8 @@ // Initialise function arguments not being substituted (if any) $timestamp = gmmktime(8, 8, 8, 8, 8, 2008); -setlocale(LC_ALL, "en_US.utf8", "en_US"); +setlocale(LC_TIME, "POSIX"); +putenv("LC_TIME=POSIX"); date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over @@ -46,13 +47,13 @@ --Preferred date and time representation-- string(2) "%c" -string(31) "Fri 08 Aug 2008 08:08:08 AM GMT" +string(24) "Fri Aug 8 08:08:08 2008" --Preferred date representation-- string(2) "%x" -string(10) "08/08/2008" +string(8) "08/08/08" --Preferred time representation-- string(2) "%X" -string(11) "08:08:08 AM" +string(8) "08:08:08" ===DONE=== Modified: php/php-src/branches/PHP_5_3/ext/date/tests/strftime_variation22.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/strftime_variation22.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_3/ext/date/tests/strftime_variation22.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -5,8 +5,8 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { die("skip Test is not valid for Windows"); } -if(!setlocale(LC_ALL, "en_US.utf8", "en_US")) { - die("skip Locale en_US.utf8 or en_US is needed by test and is not available"); +if(!setlocale(LC_ALL, "POSIX")) { + die("skip Locale POSIX is needed by test and is not available"); } ?> --FILE-- @@ -20,7 +20,8 @@ echo "*** Testing strftime() : usage variation ***\n"; // Initialise function arguments not being substituted (if any) -setlocale(LC_ALL, "en_US.utf8", "en_US"); +setlocale(LC_ALL, "POSIX"); +putenv("LC_ALL=POSIX"); date_default_timezone_set("Asia/Calcutta"); $timestamp = mktime(8, 8, 8, 8, 8, 2008); @@ -46,13 +47,13 @@ --Preferred date and time representation-- string(2) "%c" -string(31) "Fri 08 Aug 2008 08:08:08 AM IST" +string(24) "Fri Aug 8 08:08:08 2008" --Preferred date representation-- string(2) "%x" -string(10) "08/08/2008" +string(8) "08/08/08" --Preferred time representation-- string(2) "%X" -string(11) "08:08:08 AM" +string(8) "08:08:08" ===DONE=== Modified: php/php-src/branches/PHP_5_4/ext/date/tests/DateInterval_format.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/date/tests/DateInterval_format.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_4/ext/date/tests/DateInterval_format.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,5 +1,8 @@ --TEST-- -DateInterval::format() +DateInterval::format(), except %a +--DESCRIPTION-- +%a is covered in a separate test. +Don't want an XFAIL here to cause confusion if a real bug comes up. --CREDITS-- Daniel Convissor <dani...@php.net> # TestFest 2010 BKTK @@ -29,7 +32,6 @@ echo $interval->format('i=%i') . "\n"; echo $interval->format('s=%s') . "\n"; echo $interval->format('r=%r') . "\n"; -echo $interval->format('a=%a') . "\n"; echo "\n"; @@ -61,7 +63,6 @@ i=5 s=6 r= -a=428 inverted R=- inverted r=- Added: php/php-src/branches/PHP_5_4/ext/date/tests/DateInterval_format_a.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/date/tests/DateInterval_format_a.phpt (rev 0) +++ php/php-src/branches/PHP_5_4/ext/date/tests/DateInterval_format_a.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -0,0 +1,27 @@ +--TEST-- +DateInterval::format(), %a +--CREDITS-- +Daniel Convissor <dani...@php.net> +# TestFest 2010 BKTK +--INI-- +date.timezone=UTC +--SKIPIF-- +<?php +if (!method_exists('DateInterval', 'format')) die("skip: method doesn't exist"); +if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only"); +?> +--XFAIL-- +Windows VC6 libs' floor()/ceil() choke on floats +--FILE-- +<?php + +$date1 = new DateTime('2000-01-01 00:00:00'); +$date2 = new DateTime('2001-03-04 04:05:06'); + +$interval = $date1->diff($date2); + +echo $interval->format('a=%a') . "\n"; + +?> +--EXPECT-- +a=428 Added: php/php-src/branches/PHP_5_4/ext/date/tests/bug52062-64bit.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/date/tests/bug52062-64bit.phpt (rev 0) +++ php/php-src/branches/PHP_5_4/ext/date/tests/bug52062-64bit.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -0,0 +1,27 @@ +--TEST-- +Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp (64 bit) +--SKIPIF-- +<?php +if (PHP_INT_SIZE == 4) die('skip 64 bit only'); +?> +--INI-- +date.timezone=UTC +--FILE-- +<?php +$d = new DateTime('@100000000000'); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$d->setTimestamp(100000000000); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$i = new DateInterval('PT100000000000S'); +var_dump($i->format('%s')); +?> +--EXPECT-- +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(12) "100000000000" Modified: php/php-src/branches/PHP_5_4/ext/date/tests/bug52062.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/date/tests/bug52062.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_4/ext/date/tests/bug52062.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,8 +1,8 @@ --TEST-- -Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp +Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp (32 bit) --SKIPIF-- <?php -if (PHP_INT_SIZE == 4) die('skip tests require 64bit integer (php\' int, long in C.'); +if (PHP_INT_SIZE == 8) die('skip 32-bit only'); ?> --INI-- date.timezone=UTC Modified: php/php-src/branches/PHP_5_4/ext/date/tests/bug53502.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/date/tests/bug53502.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_4/ext/date/tests/bug53502.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,5 +1,7 @@ --TEST-- Bug #53502: strtotime with timezone memory leak +--INI-- +date.timezone=UTC --FILE-- <?php for ($i = 0; $i < 1000; $i++) { Modified: php/php-src/branches/PHP_5_4/ext/date/tests/date_default_timezone_set-1.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/date/tests/date_default_timezone_set-1.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/branches/PHP_5_4/ext/date/tests/date_default_timezone_set-1.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,5 +1,9 @@ --TEST-- date_default_timezone_set() function [1] +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die('skip diff TZ detection on windows.'); +?> --INI-- date.timezone= --FILE-- Modified: php/php-src/trunk/ext/date/tests/DateInterval_format.phpt =================================================================== --- php/php-src/trunk/ext/date/tests/DateInterval_format.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/trunk/ext/date/tests/DateInterval_format.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,5 +1,8 @@ --TEST-- -DateInterval::format() +DateInterval::format(), except %a +--DESCRIPTION-- +%a is covered in a separate test. +Don't want an XFAIL here to cause confusion if a real bug comes up. --CREDITS-- Daniel Convissor <dani...@php.net> # TestFest 2010 BKTK @@ -29,7 +32,6 @@ echo $interval->format('i=%i') . "\n"; echo $interval->format('s=%s') . "\n"; echo $interval->format('r=%r') . "\n"; -echo $interval->format('a=%a') . "\n"; echo "\n"; @@ -61,7 +63,6 @@ i=5 s=6 r= -a=428 inverted R=- inverted r=- Added: php/php-src/trunk/ext/date/tests/DateInterval_format_a.phpt =================================================================== --- php/php-src/trunk/ext/date/tests/DateInterval_format_a.phpt (rev 0) +++ php/php-src/trunk/ext/date/tests/DateInterval_format_a.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -0,0 +1,27 @@ +--TEST-- +DateInterval::format(), %a +--CREDITS-- +Daniel Convissor <dani...@php.net> +# TestFest 2010 BKTK +--INI-- +date.timezone=UTC +--SKIPIF-- +<?php +if (!method_exists('DateInterval', 'format')) die("skip: method doesn't exist"); +if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only"); +?> +--XFAIL-- +Windows VC6 libs' floor()/ceil() choke on floats +--FILE-- +<?php + +$date1 = new DateTime('2000-01-01 00:00:00'); +$date2 = new DateTime('2001-03-04 04:05:06'); + +$interval = $date1->diff($date2); + +echo $interval->format('a=%a') . "\n"; + +?> +--EXPECT-- +a=428 Added: php/php-src/trunk/ext/date/tests/bug52062-64bit.phpt =================================================================== --- php/php-src/trunk/ext/date/tests/bug52062-64bit.phpt (rev 0) +++ php/php-src/trunk/ext/date/tests/bug52062-64bit.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -0,0 +1,27 @@ +--TEST-- +Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp (64 bit) +--SKIPIF-- +<?php +if (PHP_INT_SIZE == 4) die('skip 64 bit only'); +?> +--INI-- +date.timezone=UTC +--FILE-- +<?php +$d = new DateTime('@100000000000'); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$d->setTimestamp(100000000000); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$i = new DateInterval('PT100000000000S'); +var_dump($i->format('%s')); +?> +--EXPECT-- +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(12) "100000000000" Modified: php/php-src/trunk/ext/date/tests/bug52062.phpt =================================================================== --- php/php-src/trunk/ext/date/tests/bug52062.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/trunk/ext/date/tests/bug52062.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,8 +1,8 @@ --TEST-- -Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp +Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp (32 bit) --SKIPIF-- <?php -if (PHP_INT_SIZE == 4) die('skip tests require 64bit integer (php\' int, long in C.'); +if (PHP_INT_SIZE == 8) die('skip 32-bit only'); ?> --INI-- date.timezone=UTC Modified: php/php-src/trunk/ext/date/tests/bug53502.phpt =================================================================== --- php/php-src/trunk/ext/date/tests/bug53502.phpt 2011-12-07 19:22:44 UTC (rev 320603) +++ php/php-src/trunk/ext/date/tests/bug53502.phpt 2011-12-07 19:24:58 UTC (rev 320604) @@ -1,5 +1,7 @@ --TEST-- Bug #53502: strtotime with timezone memory leak +--INI-- +date.timezone=UTC --FILE-- <?php for ($i = 0; $i < 1000; $i++) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php