xref: /PHP-7.0/ext/date/tests/localtime_error.phpt (revision a2e47734)
1--TEST--
2Test localtime() function : error conditions
3--FILE--
4<?php
5/* Prototype  : array localtime([int timestamp [, bool associative_array]])
6 * Description: Returns the results of the C system call localtime as an associative array
7 * if the associative_array argument is set to 1 other wise it is a regular array
8 * Source code: ext/date/php_date.c
9 * Alias to functions:
10 */
11
12//Set the default time zone
13date_default_timezone_set("Europe/London");
14
15echo "*** Testing localtime() : error conditions ***\n";
16
17echo "\n-- Testing localtime() function with more than expected no. of arguments --\n";
18$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
19$assoc = true;
20$extra_arg = 10;
21var_dump( localtime($timestamp, $assoc, $extra_arg) );
22
23?>
24===DONE===
25--EXPECTF--
26*** Testing localtime() : error conditions ***
27
28-- Testing localtime() function with more than expected no. of arguments --
29
30Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d
31bool(false)
32===DONE===
33
34