1--TEST--
2Test gmdate() function : usage variation - Valid and invalid range of timestamp 32 bits.
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 4) die('skip 32 bit only');
6?>
7--FILE--
8<?php
9echo "*** Testing gmdate() : usage variation ***\n";
10
11// Initialise all required variables
12date_default_timezone_set('UTC');
13
14echo "\n-- Testing gmdate() function with minimum range of timestamp --\n";
15$timestamp = mktime(20, 45, 54, 12, 13, 1901);
16var_dump( gmdate(DATE_ISO8601, $timestamp) );
17
18echo "\n-- Testing gmdate() function with less than the range of timestamp --\n";
19$timestamp = mktime(20, 45, 50, 12, 13, 1901);
20var_dump( gmdate(DATE_ISO8601, $timestamp) );
21
22echo "\n-- Testing gmdate() function with maximum range of timestamp --\n";
23$timestamp = mktime(03, 14, 07, 1, 19, 2038);
24var_dump( gmdate(DATE_ISO8601, $timestamp) );
25
26echo "\n-- Testing gmdate() function with greater than the range of timestamp --\n";
27$timestamp = mktime(03, 14, 10, 1, 19, 2038);
28var_dump( gmdate(DATE_ISO8601, $timestamp) );
29
30?>
31--EXPECTF--
32*** Testing gmdate() : usage variation ***
33
34-- Testing gmdate() function with minimum range of timestamp --
35string(24) "1901-12-13T20:45:54+0000"
36
37-- Testing gmdate() function with less than the range of timestamp --
38
39Warning: mktime(): Epoch doesn't fit in a PHP integer in %s on line %d
40string(24) "1970-01-01T00:00:00+0000"
41
42-- Testing gmdate() function with maximum range of timestamp --
43string(24) "2038-01-19T03:14:07+0000"
44
45-- Testing gmdate() function with greater than the range of timestamp --
46
47Warning: mktime(): Epoch doesn't fit in a PHP integer in %s on line %d
48string(24) "1970-01-01T00:00:00+0000"
49