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; 19var_dump( new DateTime($time, $timezone, $extra_arg) ); 20 21?> 22===DONE=== 23--EXPECTF-- 24*** Testing date_create() : error conditions *** 25 26-- Testing new DateTime() with more than expected no. of arguments -- 27 28Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects at most 2 parameters, 3 given' in %s:%d 29Stack trace: 30#0 %s(%d): DateTime->__construct('GMT', Object(DateTimeZone), 99) 31#1 {main} 32 thrown in %s on line %d