1--TEST-- 2Test new DateTime() : error conditions 3--FILE-- 4<?php 5/* Prototype : DateTime::__construct ([ string $time="now" [, DateTimeZone $timezone=NULL ]] ) 6 * Description: Returns new DateTime object 7 * Source code: ext/date/php_date.c 8 * Alias to functions: 9 */ 10//Set the default time zone 11date_default_timezone_set("GMT"); 12 13echo "*** Testing date_create() : error conditions ***\n"; 14 15echo "\n-- Testing new DateTime() with more than expected no. of arguments --\n"; 16$time = "GMT"; 17$timezone = timezone_open("GMT"); 18$extra_arg = 99; 19try { 20 var_dump( new DateTime($time, $timezone, $extra_arg) ); 21} catch (TypeError $e) { 22 echo $e->getMessage(), "\n"; 23} 24 25?> 26===DONE=== 27--EXPECT-- 28*** Testing date_create() : error conditions *** 29 30-- Testing new DateTime() with more than expected no. of arguments -- 31DateTime::__construct() expects at most 2 parameters, 3 given 32===DONE=== 33