summaryrefslogtreecommitdiff
path: root/ext/date/tests
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/date/tests
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/date/tests')
-rw-r--r--ext/date/tests/002.phpt93
-rw-r--r--ext/date/tests/003.phpt46
-rw-r--r--ext/date/tests/004.phpt73
-rw-r--r--ext/date/tests/005.phpt44
-rw-r--r--ext/date/tests/006.phpt32
-rw-r--r--ext/date/tests/007.phpt100
-rw-r--r--ext/date/tests/008.phpt66
-rw-r--r--ext/date/tests/009.phpt50
-rw-r--r--ext/date/tests/009_win32.phpt50
-rw-r--r--ext/date/tests/010.phpt67
-rw-r--r--ext/date/tests/011.phpt22
-rw-r--r--ext/date/tests/012.phpt57
-rw-r--r--ext/date/tests/013.phpt57
-rw-r--r--ext/date/tests/014.phpt38
-rw-r--r--ext/date/tests/015.phpt21
-rw-r--r--ext/date/tests/DateInterval_format.phpt71
-rw-r--r--ext/date/tests/DateInterval_format_a.phpt24
-rw-r--r--ext/date/tests/DatePeriod_wrong_constructor.phpt17
-rw-r--r--ext/date/tests/DateTimeZone_clone_basic1.phpt39
-rw-r--r--ext/date/tests/DateTimeZone_clone_basic2.phpt66
-rw-r--r--ext/date/tests/DateTimeZone_clone_basic3.phpt75
-rw-r--r--ext/date/tests/DateTimeZone_clone_basic4.phpt28
-rw-r--r--ext/date/tests/DateTimeZone_compare_basic1.phpt54
-rw-r--r--ext/date/tests/DateTimeZone_construct_basic.phpt30
-rw-r--r--ext/date/tests/DateTimeZone_construct_error.phpt32
-rw-r--r--ext/date/tests/DateTimeZone_construct_variation1.phpt200
-rw-r--r--ext/date/tests/DateTimeZone_extends_basic1.phpt34
-rw-r--r--ext/date/tests/DateTimeZone_getName_basic1.phpt32
-rw-r--r--ext/date/tests/DateTimeZone_getName_error.phpt31
-rw-r--r--ext/date/tests/DateTimeZone_getOffset_basic1.phpt33
-rw-r--r--ext/date/tests/DateTimeZone_getOffset_error.phpt40
-rw-r--r--ext/date/tests/DateTimeZone_getOffset_variation1.phpt252
-rw-r--r--ext/date/tests/DateTimeZone_getTransitions_basic1.phpt50
-rw-r--r--ext/date/tests/DateTimeZone_getTransitions_error.phpt34
-rw-r--r--ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt70
-rw-r--r--ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt36
-rw-r--r--ext/date/tests/DateTimeZone_serialize.phpt29
-rw-r--r--ext/date/tests/DateTimeZone_verify.phpt111
-rw-r--r--ext/date/tests/DateTime_add-dates.phpt29
-rw-r--r--ext/date/tests/DateTime_add-fall-type2-type2.phpt51
-rw-r--r--ext/date/tests/DateTime_add-fall-type2-type3.phpt53
-rw-r--r--ext/date/tests/DateTime_add-fall-type3-type2.phpt53
-rw-r--r--ext/date/tests/DateTime_add-fall-type3-type3.phpt53
-rw-r--r--ext/date/tests/DateTime_add-february.phpt77
-rw-r--r--ext/date/tests/DateTime_add-massive.phpt15
-rw-r--r--ext/date/tests/DateTime_add-spring-type2-type2.phpt31
-rw-r--r--ext/date/tests/DateTime_add-spring-type2-type3.phpt33
-rw-r--r--ext/date/tests/DateTime_add-spring-type3-type2.phpt33
-rw-r--r--ext/date/tests/DateTime_add-spring-type3-type3.phpt33
-rw-r--r--ext/date/tests/DateTime_clone_basic1.phpt29
-rw-r--r--ext/date/tests/DateTime_clone_basic2.phpt90
-rw-r--r--ext/date/tests/DateTime_clone_basic3.phpt105
-rw-r--r--ext/date/tests/DateTime_clone_basic4.phpt31
-rw-r--r--ext/date/tests/DateTime_compare_basic1.phpt77
-rw-r--r--ext/date/tests/DateTime_construct-dst-overlap.phpt15
-rw-r--r--ext/date/tests/DateTime_construct_basic1.phpt58
-rw-r--r--ext/date/tests/DateTime_construct_error.phpt32
-rw-r--r--ext/date/tests/DateTime_construct_variation1.phpt377
-rw-r--r--ext/date/tests/DateTime_construct_variation2.phpt232
-rw-r--r--ext/date/tests/DateTime_data-absolute.inc24
-rw-r--r--ext/date/tests/DateTime_data-dates.inc66
-rw-r--r--ext/date/tests/DateTime_data-fall-type2-type2.inc211
-rw-r--r--ext/date/tests/DateTime_data-fall-type2-type3.inc225
-rw-r--r--ext/date/tests/DateTime_data-fall-type3-type2.inc227
-rw-r--r--ext/date/tests/DateTime_data-fall-type3-type3.inc239
-rw-r--r--ext/date/tests/DateTime_data-february.inc217
-rw-r--r--ext/date/tests/DateTime_data-massive.inc34
-rw-r--r--ext/date/tests/DateTime_data-spring-type2-type2.inc109
-rw-r--r--ext/date/tests/DateTime_data-spring-type2-type3.inc109
-rw-r--r--ext/date/tests/DateTime_data-spring-type3-type2.inc109
-rw-r--r--ext/date/tests/DateTime_data-spring-type3-type3.inc109
-rw-r--r--ext/date/tests/DateTime_days-absolute.phpt15
-rw-r--r--ext/date/tests/DateTime_days-dates.phpt29
-rw-r--r--ext/date/tests/DateTime_days-fall-type2-type2.phpt51
-rw-r--r--ext/date/tests/DateTime_days-fall-type2-type3.phpt51
-rw-r--r--ext/date/tests/DateTime_days-fall-type3-type2.phpt51
-rw-r--r--ext/date/tests/DateTime_days-fall-type3-type3.phpt51
-rw-r--r--ext/date/tests/DateTime_days-february.phpt77
-rw-r--r--ext/date/tests/DateTime_days-massive.phpt15
-rw-r--r--ext/date/tests/DateTime_days-spring-type2-type2.phpt31
-rw-r--r--ext/date/tests/DateTime_days-spring-type2-type3.phpt31
-rw-r--r--ext/date/tests/DateTime_days-spring-type3-type2.phpt31
-rw-r--r--ext/date/tests/DateTime_days-spring-type3-type3.phpt31
-rw-r--r--ext/date/tests/DateTime_diff-absolute.phpt15
-rw-r--r--ext/date/tests/DateTime_diff-dates.phpt29
-rw-r--r--ext/date/tests/DateTime_diff-fall-type2-type2.phpt51
-rw-r--r--ext/date/tests/DateTime_diff-fall-type2-type3.phpt53
-rw-r--r--ext/date/tests/DateTime_diff-fall-type3-type2.phpt53
-rw-r--r--ext/date/tests/DateTime_diff-fall-type3-type3.phpt53
-rw-r--r--ext/date/tests/DateTime_diff-february.phpt77
-rw-r--r--ext/date/tests/DateTime_diff-massive.phpt15
-rw-r--r--ext/date/tests/DateTime_diff-spring-type2-type2.phpt31
-rw-r--r--ext/date/tests/DateTime_diff-spring-type2-type3.phpt33
-rw-r--r--ext/date/tests/DateTime_diff-spring-type3-type2.phpt33
-rw-r--r--ext/date/tests/DateTime_diff-spring-type3-type3.phpt33
-rw-r--r--ext/date/tests/DateTime_extends_basic1.phpt49
-rw-r--r--ext/date/tests/DateTime_extends_basic2.phpt31
-rw-r--r--ext/date/tests/DateTime_extends_basic3.phpt26
-rw-r--r--ext/date/tests/DateTime_format_basic1.phpt40
-rw-r--r--ext/date/tests/DateTime_format_basic2.phpt44
-rw-r--r--ext/date/tests/DateTime_format_error.phpt41
-rw-r--r--ext/date/tests/DateTime_format_variation1.phpt208
-rw-r--r--ext/date/tests/DateTime_getOffset_basic1.phpt28
-rw-r--r--ext/date/tests/DateTime_getOffset_error.phpt33
-rw-r--r--ext/date/tests/DateTime_getTimeZone_basic1.phpt33
-rw-r--r--ext/date/tests/DateTime_modify_basic1.phpt39
-rw-r--r--ext/date/tests/DateTime_modify_error.phpt42
-rw-r--r--ext/date/tests/DateTime_modify_variation1.phpt262
-rw-r--r--ext/date/tests/DateTime_serialize.phpt39
-rw-r--r--ext/date/tests/DateTime_setDate_basic1.phpt30
-rw-r--r--ext/date/tests/DateTime_setDate_error.phpt53
-rw-r--r--ext/date/tests/DateTime_setDate_variation1.phpt329
-rw-r--r--ext/date/tests/DateTime_setDate_variation2.phpt329
-rw-r--r--ext/date/tests/DateTime_setDate_variation3.phpt329
-rw-r--r--ext/date/tests/DateTime_setISODate_basic1.phpt38
-rw-r--r--ext/date/tests/DateTime_setISODate_error.phpt51
-rw-r--r--ext/date/tests/DateTime_setISODate_variation1.phpt329
-rw-r--r--ext/date/tests/DateTime_setISODate_variation2.phpt329
-rw-r--r--ext/date/tests/DateTime_setISODate_variation3.phpt329
-rw-r--r--ext/date/tests/DateTime_setTime_basic1.phpt46
-rw-r--r--ext/date/tests/DateTime_setTime_error.phpt49
-rw-r--r--ext/date/tests/DateTime_setTime_variation1.phpt329
-rw-r--r--ext/date/tests/DateTime_setTime_variation2.phpt329
-rw-r--r--ext/date/tests/DateTime_setTime_variation3.phpt329
-rw-r--r--ext/date/tests/DateTime_setTimezone_basic1.phpt29
-rw-r--r--ext/date/tests/DateTime_setTimezone_error.phpt39
-rw-r--r--ext/date/tests/DateTime_setTimezone_variation1.phpt252
-rw-r--r--ext/date/tests/DateTime_sub-dates.phpt29
-rw-r--r--ext/date/tests/DateTime_sub-fall-type2-type2.phpt51
-rw-r--r--ext/date/tests/DateTime_sub-fall-type2-type3.phpt53
-rw-r--r--ext/date/tests/DateTime_sub-fall-type3-type2.phpt53
-rw-r--r--ext/date/tests/DateTime_sub-fall-type3-type3.phpt53
-rw-r--r--ext/date/tests/DateTime_sub-february.phpt77
-rw-r--r--ext/date/tests/DateTime_sub-massive.phpt15
-rw-r--r--ext/date/tests/DateTime_sub-spring-type2-type2.phpt31
-rw-r--r--ext/date/tests/DateTime_sub-spring-type2-type3.phpt33
-rw-r--r--ext/date/tests/DateTime_sub-spring-type3-type2.phpt33
-rw-r--r--ext/date/tests/DateTime_sub-spring-type3-type3.phpt33
-rw-r--r--ext/date/tests/DateTime_verify.phpt183
-rw-r--r--ext/date/tests/big_year.phpt17
-rw-r--r--ext/date/tests/bug13142.phpt25
-rw-r--r--ext/date/tests/bug14561.phpt12
-rw-r--r--ext/date/tests/bug17988.phpt34
-rw-r--r--ext/date/tests/bug20382-1.phpt17
-rw-r--r--ext/date/tests/bug20382-2.phpt170
-rw-r--r--ext/date/tests/bug21399.phpt10
-rw-r--r--ext/date/tests/bug21966.phpt19
-rw-r--r--ext/date/tests/bug26090.phpt15
-rw-r--r--ext/date/tests/bug26198.phpt11
-rw-r--r--ext/date/tests/bug26317.phpt18
-rw-r--r--ext/date/tests/bug26320.phpt16
-rw-r--r--ext/date/tests/bug26694.phpt10
-rw-r--r--ext/date/tests/bug27719.phpt67
-rw-r--r--ext/date/tests/bug27780.phpt118
-rw-r--r--ext/date/tests/bug28024.phpt12
-rw-r--r--ext/date/tests/bug28088.phpt17
-rw-r--r--ext/date/tests/bug28599.phpt9
-rw-r--r--ext/date/tests/bug29150.phpt10
-rw-r--r--ext/date/tests/bug29585.phpt9
-rw-r--r--ext/date/tests/bug29595.phpt11
-rw-r--r--ext/date/tests/bug30096.phpt48
-rw-r--r--ext/date/tests/bug30532.phpt25
-rw-r--r--ext/date/tests/bug32086.phpt51
-rw-r--r--ext/date/tests/bug32270.phpt26
-rw-r--r--ext/date/tests/bug32555.phpt21
-rw-r--r--ext/date/tests/bug32588.phpt14
-rw-r--r--ext/date/tests/bug33056.phpt13
-rw-r--r--ext/date/tests/bug33414-1.phpt321
-rw-r--r--ext/date/tests/bug33414-2.phpt121
-rw-r--r--ext/date/tests/bug33415-1.phpt33
-rw-r--r--ext/date/tests/bug33415-2.phpt342
-rw-r--r--ext/date/tests/bug33452.phpt11
-rw-r--r--ext/date/tests/bug33532.phpt43
-rw-r--r--ext/date/tests/bug33536.phpt13
-rw-r--r--ext/date/tests/bug33562.phpt11
-rw-r--r--ext/date/tests/bug33563.phpt12
-rw-r--r--ext/date/tests/bug33578.phpt21
-rw-r--r--ext/date/tests/bug33869.phpt26
-rw-r--r--ext/date/tests/bug33957.phpt103
-rw-r--r--ext/date/tests/bug34087.phpt20
-rw-r--r--ext/date/tests/bug34304.phpt11
-rw-r--r--ext/date/tests/bug34676.phpt19
-rw-r--r--ext/date/tests/bug34771.phpt32
-rw-r--r--ext/date/tests/bug35143.phpt21
-rw-r--r--ext/date/tests/bug35218.phpt14
-rw-r--r--ext/date/tests/bug35414.phpt16
-rw-r--r--ext/date/tests/bug35422.phpt12
-rw-r--r--ext/date/tests/bug35425.phpt31
-rw-r--r--ext/date/tests/bug35456.phpt16
-rw-r--r--ext/date/tests/bug35499.phpt78
-rw-r--r--ext/date/tests/bug35624.phpt29
-rw-r--r--ext/date/tests/bug35630.phpt11
-rw-r--r--ext/date/tests/bug35699.phpt14
-rw-r--r--ext/date/tests/bug35705.phpt11
-rw-r--r--ext/date/tests/bug35885.phpt21
-rw-r--r--ext/date/tests/bug35887.phpt11
-rw-r--r--ext/date/tests/bug36224.phpt13
-rw-r--r--ext/date/tests/bug36510.phpt14
-rw-r--r--ext/date/tests/bug36599.phpt12
-rw-r--r--ext/date/tests/bug36988.phpt11
-rw-r--r--ext/date/tests/bug37017.phpt15
-rw-r--r--ext/date/tests/bug37368.phpt9
-rw-r--r--ext/date/tests/bug37514.phpt19
-rw-r--r--ext/date/tests/bug37616.phpt9
-rw-r--r--ext/date/tests/bug37747.phpt11
-rw-r--r--ext/date/tests/bug38229.phpt13
-rw-r--r--ext/date/tests/bug39782.phpt19
-rw-r--r--ext/date/tests/bug40743.phpt40
-rw-r--r--ext/date/tests/bug40861.phpt33
-rw-r--r--ext/date/tests/bug41523-64bit.phpt55
-rw-r--r--ext/date/tests/bug41523.phpt55
-rw-r--r--ext/date/tests/bug41599.phpt27
-rw-r--r--ext/date/tests/bug41709.phpt34
-rw-r--r--ext/date/tests/bug41842.phpt11
-rw-r--r--ext/date/tests/bug41844.phpt17
-rw-r--r--ext/date/tests/bug41964.phpt59
-rw-r--r--ext/date/tests/bug42910.phpt30
-rw-r--r--ext/date/tests/bug43003.phpt27
-rw-r--r--ext/date/tests/bug43075.phpt10
-rw-r--r--ext/date/tests/bug43452.phpt70
-rw-r--r--ext/date/tests/bug43527.phpt10
-rw-r--r--ext/date/tests/bug43808.phpt48
-rw-r--r--ext/date/tests/bug43960.phpt9
-rw-r--r--ext/date/tests/bug44562.phpt38
-rw-r--r--ext/date/tests/bug44742.phpt36
-rw-r--r--ext/date/tests/bug45529.phpt21
-rw-r--r--ext/date/tests/bug45554.phpt20
-rw-r--r--ext/date/tests/bug45682.phpt32
-rw-r--r--ext/date/tests/bug45866.phpt24
-rw-r--r--ext/date/tests/bug46108.phpt19
-rw-r--r--ext/date/tests/bug46111.phpt21
-rw-r--r--ext/date/tests/bug46268.phpt23
-rw-r--r--ext/date/tests/bug46874.phpt31
-rw-r--r--ext/date/tests/bug48058.phpt29
-rw-r--r--ext/date/tests/bug48097.phpt38
-rw-r--r--ext/date/tests/bug48187.phpt28
-rw-r--r--ext/date/tests/bug48276.phpt9
-rw-r--r--ext/date/tests/bug48476.phpt33
-rw-r--r--ext/date/tests/bug48678.phpt31
-rw-r--r--ext/date/tests/bug49059.phpt34
-rw-r--r--ext/date/tests/bug49081.phpt22
-rw-r--r--ext/date/tests/bug49585.phpt16
-rw-r--r--ext/date/tests/bug49700.phpt15
-rw-r--r--ext/date/tests/bug49778.phpt30
-rw-r--r--ext/date/tests/bug50055.phpt30
-rw-r--r--ext/date/tests/bug50392.phpt45
-rw-r--r--ext/date/tests/bug50475.phpt18
-rw-r--r--ext/date/tests/bug50680.phpt9
-rw-r--r--ext/date/tests/bug51096.phpt55
-rw-r--r--ext/date/tests/bug51393.phpt75
-rw-r--r--ext/date/tests/bug51819.phpt34
-rw-r--r--ext/date/tests/bug51866.phpt161
-rw-r--r--ext/date/tests/bug51994.phpt37
-rw-r--r--ext/date/tests/bug52062-64bit.phpt27
-rw-r--r--ext/date/tests/bug52062.phpt31
-rw-r--r--ext/date/tests/bug52063.phpt15
-rw-r--r--ext/date/tests/bug52113.phpt102
-rw-r--r--ext/date/tests/bug52290.phpt27
-rw-r--r--ext/date/tests/bug52342.phpt23
-rw-r--r--ext/date/tests/bug52430.phpt37
-rw-r--r--ext/date/tests/bug52454.phpt22
-rw-r--r--ext/date/tests/bug52577.phpt19
-rw-r--r--ext/date/tests/bug52668.phpt25
-rw-r--r--ext/date/tests/bug52738.phpt32
-rw-r--r--ext/date/tests/bug52808.phpt85
-rw-r--r--ext/date/tests/bug53437.phpt28
-rw-r--r--ext/date/tests/bug53502.phpt13
-rw-r--r--ext/date/tests/bug54283.phpt14
-rw-r--r--ext/date/tests/bug54316.phpt28
-rw-r--r--ext/date/tests/bug54340.phpt43
-rw-r--r--ext/date/tests/bug54597.phpt18
-rw-r--r--ext/date/tests/bug54851.phpt57
-rw-r--r--ext/date/tests/bug55253.phpt45
-rw-r--r--ext/date/tests/bug55397.phpt11
-rw-r--r--ext/date/tests/bug60236.phpt22
-rw-r--r--ext/date/tests/bug62500.phpt28
-rw-r--r--ext/date/tests/bug62561.phpt16
-rw-r--r--ext/date/tests/bug62852.phpt36
-rw-r--r--ext/date/tests/bug62896.phpt42
-rw-r--r--ext/date/tests/bug63435.phpt16
-rw-r--r--ext/date/tests/cal_days_in_month_invalid_calendar.phpt16
-rw-r--r--ext/date/tests/cal_days_in_month_invalid_date.phpt16
-rw-r--r--ext/date/tests/checkdate_basic1.phpt54
-rw-r--r--ext/date/tests/checkdate_error.phpt49
-rw-r--r--ext/date/tests/checkdate_variation1.phpt202
-rw-r--r--ext/date/tests/checkdate_variation2.phpt202
-rw-r--r--ext/date/tests/checkdate_variation3.phpt201
-rw-r--r--ext/date/tests/date-lenient-create.phpt149
-rw-r--r--ext/date/tests/date-lenient.phpt146
-rw-r--r--ext/date/tests/date-parse-by-format001.phpt51
-rw-r--r--ext/date/tests/date-set-timestamp.phpt15
-rw-r--r--ext/date/tests/date-time-modify-times.phpt47
-rw-r--r--ext/date/tests/date.phpt22
-rw-r--r--ext/date/tests/date_add_basic.phpt45
-rw-r--r--ext/date/tests/date_add_basic2.phpt14
-rw-r--r--ext/date/tests/date_basic1.phpt41
-rw-r--r--ext/date/tests/date_constants.phpt75
-rw-r--r--ext/date/tests/date_create-1.phpt48
-rw-r--r--ext/date/tests/date_create-2.phpt16
-rw-r--r--ext/date/tests/date_create-relative.phpt93
-rw-r--r--ext/date/tests/date_create_basic.phpt58
-rw-r--r--ext/date/tests/date_create_error.phpt28
-rw-r--r--ext/date/tests/date_create_from_format_basic.phpt14
-rw-r--r--ext/date/tests/date_create_from_format_basic2.phpt13
-rw-r--r--ext/date/tests/date_create_variation1.phpt389
-rw-r--r--ext/date/tests/date_create_variation2.phpt272
-rw-r--r--ext/date/tests/date_date_set_basic1.phpt30
-rw-r--r--ext/date/tests/date_date_set_error.phpt56
-rw-r--r--ext/date/tests/date_date_set_variation1.phpt254
-rw-r--r--ext/date/tests/date_date_set_variation2.phpt329
-rw-r--r--ext/date/tests/date_date_set_variation3.phpt329
-rw-r--r--ext/date/tests/date_date_set_variation4.phpt329
-rw-r--r--ext/date/tests/date_default_timezone_get-1-win32.phpt24
-rw-r--r--ext/date/tests/date_default_timezone_get-1.phpt20
-rw-r--r--ext/date/tests/date_default_timezone_get-2.phpt16
-rw-r--r--ext/date/tests/date_default_timezone_get-3.phpt14
-rw-r--r--ext/date/tests/date_default_timezone_get-4.phpt11
-rw-r--r--ext/date/tests/date_default_timezone_get_error.phpt27
-rw-r--r--ext/date/tests/date_default_timezone_set-1.phpt32
-rw-r--r--ext/date/tests/date_default_timezone_set_error.phpt41
-rw-r--r--ext/date/tests/date_default_timezone_set_variation1.phpt200
-rw-r--r--ext/date/tests/date_diff.phpt63
-rw-r--r--ext/date/tests/date_diff1.phpt48
-rw-r--r--ext/date/tests/date_error.phpt39
-rw-r--r--ext/date/tests/date_format_basic1.phpt40
-rw-r--r--ext/date/tests/date_format_error.phpt67
-rw-r--r--ext/date/tests/date_format_variation1.phpt252
-rw-r--r--ext/date/tests/date_format_variation2.phpt208
-rw-r--r--ext/date/tests/date_get_last_errors_basic.phpt13
-rw-r--r--ext/date/tests/date_isodate_set_basic1.phpt38
-rw-r--r--ext/date/tests/date_isodate_set_error.phpt68
-rw-r--r--ext/date/tests/date_isodate_set_variation1.phpt254
-rw-r--r--ext/date/tests/date_isodate_set_variation2.phpt329
-rw-r--r--ext/date/tests/date_isodate_set_variation3.phpt329
-rw-r--r--ext/date/tests/date_isodate_set_variation4.phpt329
-rw-r--r--ext/date/tests/date_modify-1.phpt30
-rw-r--r--ext/date/tests/date_modify-2.phpt15
-rw-r--r--ext/date/tests/date_modify_basic1.phpt39
-rw-r--r--ext/date/tests/date_modify_error.phpt68
-rw-r--r--ext/date/tests/date_modify_variation1.phpt252
-rw-r--r--ext/date/tests/date_modify_variation2.phpt262
-rw-r--r--ext/date/tests/date_offset_get_basic1.phpt28
-rw-r--r--ext/date/tests/date_offset_get_error.phpt57
-rw-r--r--ext/date/tests/date_offset_get_variation1.phpt250
-rw-r--r--ext/date/tests/date_parse_001.phpt304
-rw-r--r--ext/date/tests/date_parse_basic1.phpt107
-rw-r--r--ext/date/tests/date_parse_error.phpt89
-rw-r--r--ext/date/tests/date_parse_from_format_basic.phpt14
-rw-r--r--ext/date/tests/date_parse_variation1.phpt274
-rw-r--r--ext/date/tests/date_period.phpt63
-rw-r--r--ext/date/tests/date_sub_basic.phpt45
-rw-r--r--ext/date/tests/date_sun_info_001.phpt31
-rw-r--r--ext/date/tests/date_sun_info_002.phpt23
-rw-r--r--ext/date/tests/date_sun_info_error.phpt46
-rw-r--r--ext/date/tests/date_sun_info_variation1.phpt492
-rw-r--r--ext/date/tests/date_sun_info_variation2.phpt492
-rw-r--r--ext/date/tests/date_sun_info_variation3.phpt493
-rw-r--r--ext/date/tests/date_sunrise_and_sunset_basic.phpt29
-rw-r--r--ext/date/tests/date_sunrise_error.phpt41
-rw-r--r--ext/date/tests/date_sunrise_variation1.phpt316
-rw-r--r--ext/date/tests/date_sunrise_variation2.phpt211
-rw-r--r--ext/date/tests/date_sunrise_variation3.phpt294
-rw-r--r--ext/date/tests/date_sunrise_variation4.phpt296
-rw-r--r--ext/date/tests/date_sunrise_variation5.phpt296
-rw-r--r--ext/date/tests/date_sunrise_variation6.phpt295
-rw-r--r--ext/date/tests/date_sunrise_variation7.phpt57
-rw-r--r--ext/date/tests/date_sunrise_variation8.phpt73
-rw-r--r--ext/date/tests/date_sunrise_variation9.phpt47
-rw-r--r--ext/date/tests/date_sunset_error.phpt50
-rw-r--r--ext/date/tests/date_sunset_variation1.phpt316
-rw-r--r--ext/date/tests/date_sunset_variation2.phpt211
-rw-r--r--ext/date/tests/date_sunset_variation3.phpt297
-rw-r--r--ext/date/tests/date_sunset_variation4.phpt296
-rw-r--r--ext/date/tests/date_sunset_variation5.phpt296
-rw-r--r--ext/date/tests/date_sunset_variation6.phpt296
-rw-r--r--ext/date/tests/date_sunset_variation7.phpt75
-rw-r--r--ext/date/tests/date_sunset_variation8.phpt73
-rw-r--r--ext/date/tests/date_sunset_variation9.phpt47
-rw-r--r--ext/date/tests/date_time_set_basic1.phpt46
-rw-r--r--ext/date/tests/date_time_set_error.phpt70
-rw-r--r--ext/date/tests/date_time_set_variation1.phpt254
-rw-r--r--ext/date/tests/date_time_set_variation2.phpt329
-rw-r--r--ext/date/tests/date_time_set_variation3.phpt329
-rw-r--r--ext/date/tests/date_time_set_variation4.phpt329
-rw-r--r--ext/date/tests/date_timestamp_get.phpt20
-rw-r--r--ext/date/tests/date_timezone_get_basic1.phpt35
-rw-r--r--ext/date/tests/date_timezone_get_error.phpt56
-rw-r--r--ext/date/tests/date_timezone_get_variation1.phpt250
-rw-r--r--ext/date/tests/date_timezone_set_basic1.phpt34
-rw-r--r--ext/date/tests/date_timezone_set_error.phpt64
-rw-r--r--ext/date/tests/date_timezone_set_variation1.phpt254
-rw-r--r--ext/date/tests/date_timezone_set_variation2.phpt252
-rw-r--r--ext/date/tests/date_variation1.phpt208
-rw-r--r--ext/date/tests/date_variation2.phpt222
-rw-r--r--ext/date/tests/default-timezone-1.phpt10
-rw-r--r--ext/date/tests/default-timezone-2.phpt10
-rw-r--r--ext/date/tests/examine_diff.inc79
-rw-r--r--ext/date/tests/format-negative-timestamp.phpt24
-rw-r--r--ext/date/tests/getdate_basic.phpt76
-rw-r--r--ext/date/tests/getdate_error.phpt31
-rw-r--r--ext/date/tests/getdate_variation1.phpt443
-rw-r--r--ext/date/tests/getdate_variation2.phpt114
-rw-r--r--ext/date/tests/getdate_variation3.phpt114
-rw-r--r--ext/date/tests/getdate_variation4.phpt141
-rw-r--r--ext/date/tests/getdate_variation5.phpt223
-rw-r--r--ext/date/tests/getdate_variation6.phpt109
-rw-r--r--ext/date/tests/getdate_variation7.phpt78
-rw-r--r--ext/date/tests/gettimeofday_basic.phpt55
-rw-r--r--ext/date/tests/gettimeofday_error.phpt29
-rw-r--r--ext/date/tests/gettimeofday_variation1.phpt284
-rw-r--r--ext/date/tests/gmdate_basic.phpt30
-rw-r--r--ext/date/tests/gmdate_error.phpt41
-rw-r--r--ext/date/tests/gmdate_variation1.phpt221
-rw-r--r--ext/date/tests/gmdate_variation10.phpt69
-rw-r--r--ext/date/tests/gmdate_variation11.phpt45
-rw-r--r--ext/date/tests/gmdate_variation12.phpt48
-rw-r--r--ext/date/tests/gmdate_variation13.phpt82
-rw-r--r--ext/date/tests/gmdate_variation14.phpt34
-rw-r--r--ext/date/tests/gmdate_variation2.phpt210
-rw-r--r--ext/date/tests/gmdate_variation3.phpt59
-rw-r--r--ext/date/tests/gmdate_variation4.phpt45
-rw-r--r--ext/date/tests/gmdate_variation5.phpt29
-rw-r--r--ext/date/tests/gmdate_variation6.phpt61
-rw-r--r--ext/date/tests/gmdate_variation7.phpt60
-rw-r--r--ext/date/tests/gmdate_variation8.phpt60
-rw-r--r--ext/date/tests/gmdate_variation9.phpt81
-rw-r--r--ext/date/tests/gmmktime_basic.phpt35
-rw-r--r--ext/date/tests/gmmktime_error.phpt39
-rw-r--r--ext/date/tests/gmmktime_variation1.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation2.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation3.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation4.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation5.phpt194
-rw-r--r--ext/date/tests/gmmktime_variation6.phpt190
-rw-r--r--ext/date/tests/gmmktime_variation7.phpt54
-rw-r--r--ext/date/tests/gmmktime_variation8.phpt44
-rw-r--r--ext/date/tests/gmmktime_variation9.phpt62
-rw-r--r--ext/date/tests/gmstrftime_basic.phpt29
-rw-r--r--ext/date/tests/gmstrftime_error.phpt38
-rw-r--r--ext/date/tests/gmstrftime_variation1.phpt220
-rw-r--r--ext/date/tests/gmstrftime_variation10.phpt50
-rw-r--r--ext/date/tests/gmstrftime_variation11.phpt37
-rw-r--r--ext/date/tests/gmstrftime_variation12.phpt37
-rw-r--r--ext/date/tests/gmstrftime_variation13.phpt60
-rw-r--r--ext/date/tests/gmstrftime_variation14.phpt60
-rw-r--r--ext/date/tests/gmstrftime_variation15.phpt55
-rw-r--r--ext/date/tests/gmstrftime_variation16.phpt55
-rw-r--r--ext/date/tests/gmstrftime_variation17.phpt37
-rw-r--r--ext/date/tests/gmstrftime_variation18.phpt37
-rw-r--r--ext/date/tests/gmstrftime_variation19.phpt50
-rw-r--r--ext/date/tests/gmstrftime_variation2.phpt206
-rw-r--r--ext/date/tests/gmstrftime_variation20.phpt52
-rw-r--r--ext/date/tests/gmstrftime_variation21.phpt55
-rw-r--r--ext/date/tests/gmstrftime_variation22.phpt59
-rw-r--r--ext/date/tests/gmstrftime_variation3.phpt52
-rw-r--r--ext/date/tests/gmstrftime_variation4.phpt47
-rw-r--r--ext/date/tests/gmstrftime_variation5.phpt51
-rw-r--r--ext/date/tests/gmstrftime_variation6.phpt59
-rw-r--r--ext/date/tests/gmstrftime_variation7.phpt49
-rw-r--r--ext/date/tests/gmstrftime_variation8.phpt39
-rw-r--r--ext/date/tests/gmstrftime_variation9.phpt50
-rw-r--r--ext/date/tests/idate_basic.phpt24
-rw-r--r--ext/date/tests/idate_error.phpt37
-rw-r--r--ext/date/tests/idate_variation1.phpt301
-rw-r--r--ext/date/tests/idate_variation2.phpt191
-rw-r--r--ext/date/tests/idate_variation3.phpt35
-rw-r--r--ext/date/tests/idate_variation4.phpt66
-rw-r--r--ext/date/tests/idate_variation5.phpt62
-rw-r--r--ext/date/tests/idate_variation6.phpt34
-rw-r--r--ext/date/tests/localtime_basic.phpt93
-rw-r--r--ext/date/tests/localtime_error.phpt33
-rw-r--r--ext/date/tests/localtime_variation1.phpt658
-rw-r--r--ext/date/tests/localtime_variation2.phpt643
-rw-r--r--ext/date/tests/localtime_variation3.phpt116
-rw-r--r--ext/date/tests/localtime_variation4.phpt162
-rw-r--r--ext/date/tests/localtime_variation5.phpt162
-rw-r--r--ext/date/tests/microtime_basic.phpt20
-rw-r--r--ext/date/tests/microtime_error.phpt72
-rw-r--r--ext/date/tests/mktime-1.phpt44
-rw-r--r--ext/date/tests/mktime-2.phpt51
-rw-r--r--ext/date/tests/mktime-3-64bit.phpt60
-rw-r--r--ext/date/tests/mktime-3.phpt59
-rw-r--r--ext/date/tests/mktime_basic1.phpt47
-rw-r--r--ext/date/tests/mktime_error.phpt45
-rw-r--r--ext/date/tests/mktime_variation1.phpt224
-rw-r--r--ext/date/tests/mktime_variation2.phpt218
-rw-r--r--ext/date/tests/mktime_variation3.phpt219
-rw-r--r--ext/date/tests/mktime_variation4.phpt220
-rw-r--r--ext/date/tests/mktime_variation5.phpt221
-rw-r--r--ext/date/tests/mktime_variation6.phpt223
-rw-r--r--ext/date/tests/mktime_variation7.phpt251
-rw-r--r--ext/date/tests/oo_001.phpt52
-rw-r--r--ext/date/tests/oo_002.phpt27
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt380
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt380
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type3.phpt399
-rw-r--r--ext/date/tests/strftime_basic.phpt30
-rw-r--r--ext/date/tests/strftime_error.phpt30
-rw-r--r--ext/date/tests/strftime_variation1.phpt222
-rw-r--r--ext/date/tests/strftime_variation10.phpt50
-rw-r--r--ext/date/tests/strftime_variation11.phpt37
-rw-r--r--ext/date/tests/strftime_variation12.phpt37
-rw-r--r--ext/date/tests/strftime_variation13.phpt60
-rw-r--r--ext/date/tests/strftime_variation14.phpt60
-rw-r--r--ext/date/tests/strftime_variation15.phpt55
-rw-r--r--ext/date/tests/strftime_variation16.phpt55
-rw-r--r--ext/date/tests/strftime_variation17.phpt36
-rw-r--r--ext/date/tests/strftime_variation18.phpt36
-rw-r--r--ext/date/tests/strftime_variation19.phpt50
-rw-r--r--ext/date/tests/strftime_variation2.phpt191
-rw-r--r--ext/date/tests/strftime_variation20.phpt52
-rw-r--r--ext/date/tests/strftime_variation21.phpt55
-rw-r--r--ext/date/tests/strftime_variation22.phpt59
-rw-r--r--ext/date/tests/strftime_variation23.phpt36
-rw-r--r--ext/date/tests/strftime_variation3.phpt52
-rw-r--r--ext/date/tests/strftime_variation4.phpt48
-rw-r--r--ext/date/tests/strftime_variation5.phpt50
-rw-r--r--ext/date/tests/strftime_variation6.phpt60
-rw-r--r--ext/date/tests/strftime_variation7.phpt50
-rw-r--r--ext/date/tests/strftime_variation8.phpt31
-rw-r--r--ext/date/tests/strftime_variation9.phpt50
-rw-r--r--ext/date/tests/strtotime-mysql-64bit.phpt28
-rw-r--r--ext/date/tests/strtotime-mysql.phpt27
-rw-r--r--ext/date/tests/strtotime-relative.phpt98
-rw-r--r--ext/date/tests/strtotime.phpt20
-rw-r--r--ext/date/tests/strtotime2.phpt40
-rw-r--r--ext/date/tests/strtotime3-64bit.phpt71
-rw-r--r--ext/date/tests/strtotime3.phpt71
-rw-r--r--ext/date/tests/strtotime_basic.phpt46
-rw-r--r--ext/date/tests/strtotime_basic2.phpt13
-rw-r--r--ext/date/tests/strtotime_variation_scottish.phpt15
-rw-r--r--ext/date/tests/sunfuncts.phpt42
-rw-r--r--ext/date/tests/test-parse-from-format.phpt143
-rw-r--r--ext/date/tests/time_basic.phpt16
-rw-r--r--ext/date/tests/time_error.phpt19
-rw-r--r--ext/date/tests/timestamp-in-dst.phpt11
-rw-r--r--ext/date/tests/timezone-configuration.phpt19
-rw-r--r--ext/date/tests/timezone_abbreviations_list_basic1.phpt70
-rw-r--r--ext/date/tests/timezone_identifiers_list_basic1.phpt36
-rw-r--r--ext/date/tests/timezone_identifiers_list_wrong_constructor.phpt15
-rw-r--r--ext/date/tests/timezone_location_get.phpt24
-rw-r--r--ext/date/tests/timezone_name_from_abbr_basic1.phpt68
-rw-r--r--ext/date/tests/timezone_name_from_abbr_error.phpt42
-rw-r--r--ext/date/tests/timezone_name_from_abbr_variation1.phpt205
-rw-r--r--ext/date/tests/timezone_name_from_abbr_variation2.phpt219
-rw-r--r--ext/date/tests/timezone_name_from_abbr_variation3.phpt219
-rw-r--r--ext/date/tests/timezone_name_get_error.phpt56
-rw-r--r--ext/date/tests/timezone_offset_get_basic1.phpt34
-rw-r--r--ext/date/tests/timezone_offset_get_error.phpt84
-rw-r--r--ext/date/tests/timezone_offset_get_variation1.phpt252
-rw-r--r--ext/date/tests/timezone_offset_get_variation2.phpt252
-rw-r--r--ext/date/tests/timezone_open_basic1.phpt27
-rw-r--r--ext/date/tests/timezone_open_error.phpt35
-rw-r--r--ext/date/tests/timezone_open_variation1.phpt251
-rw-r--r--ext/date/tests/timezone_transitions_get_basic1.phpt53
-rw-r--r--ext/date/tests/timezone_transitions_get_error.phpt58
-rw-r--r--ext/date/tests/timezone_transitions_get_variation1.phpt250
-rw-r--r--ext/date/tests/timezone_transitions_get_variation2.phpt253
-rw-r--r--ext/date/tests/timezone_transitions_get_variation3.phpt253
-rw-r--r--ext/date/tests/timezones-list.phpt49
-rw-r--r--ext/date/tests/timezones.phpt26
561 files changed, 49149 insertions, 0 deletions
diff --git a/ext/date/tests/002.phpt b/ext/date/tests/002.phpt
new file mode 100644
index 0000000..92d0d5f
--- /dev/null
+++ b/ext/date/tests/002.phpt
@@ -0,0 +1,93 @@
+--TEST--
+strtotime() function
+--SKIPIF--
+<?php
+if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+?>
+--FILE--
+<?php
+ $dates = array (
+ "1999-10-13",
+ "Oct 13 1999",
+ "2000-01-19",
+ "Jan 19 2000",
+ "2001-12-21",
+ "Dec 21 2001",
+ "2001-12-21 12:16",
+ "Dec 21 2001 12:16",
+ "Dec 21 12:16",
+ "2001-10-22 21:19:58",
+ "2001-10-22 21:19:58-02",
+ "2001-10-22 21:19:58-0213",
+ "2001-10-22 21:19:58+02",
+ "2001-10-22 21:19:58+0213",
+ "2001-10-22T21:20:58-03:40",
+ "2001-10-22T211958-2",
+ "20011022T211958+0213",
+ "20011022T21:20+0215",
+ "1997W011",
+ "2004W101T05:00+0",
+ );
+
+ echo "*** GMT0\n";
+ date_default_timezone_set("GMT0");
+ foreach ($dates as $date) {
+ echo date ("Y-m-d H:i:s\n", strtotime ($date));
+ }
+
+ echo "*** US/Eastern\n";
+ date_default_timezone_set("US/Eastern");
+ if( date("T") == "GMT" ) {
+ // POSIX style
+ date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0");
+ }
+
+ foreach ($dates as $date) {
+ echo date ("Y-m-d H:i:s\n", strtotime ($date));
+ }
+?>
+--EXPECTF--
+*** GMT0
+1999-10-13 00:00:00
+1999-10-13 00:00:00
+2000-01-19 00:00:00
+2000-01-19 00:00:00
+2001-12-21 00:00:00
+2001-12-21 00:00:00
+2001-12-21 12:16:00
+2001-12-21 12:16:00
+%d-12-21 12:16:00
+2001-10-22 21:19:58
+2001-10-22 23:19:58
+2001-10-22 23:32:58
+2001-10-22 19:19:58
+2001-10-22 19:06:58
+2001-10-23 01:00:58
+2001-10-22 23:19:58
+2001-10-22 19:06:58
+2001-10-22 19:05:00
+1996-12-30 00:00:00
+2004-03-01 05:00:00
+*** US/Eastern
+1999-10-13 00:00:00
+1999-10-13 00:00:00
+2000-01-19 00:00:00
+2000-01-19 00:00:00
+2001-12-21 00:00:00
+2001-12-21 00:00:00
+2001-12-21 12:16:00
+2001-12-21 12:16:00
+%d-12-21 12:16:00
+2001-10-22 21:19:58
+2001-10-22 19:19:58
+2001-10-22 19:32:58
+2001-10-22 15:19:58
+2001-10-22 15:06:58
+2001-10-22 21:00:58
+2001-10-22 19:19:58
+2001-10-22 15:06:58
+2001-10-22 15:05:00
+1996-12-30 00:00:00
+2004-03-01 00:00:00
diff --git a/ext/date/tests/003.phpt b/ext/date/tests/003.phpt
new file mode 100644
index 0000000..2be6cf7
--- /dev/null
+++ b/ext/date/tests/003.phpt
@@ -0,0 +1,46 @@
+--TEST--
+date suffixes test
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+for ($i = 0; $i < 32; $i++) {
+ var_dump(date("jS", mktime(0,0,0, 1, $i, 2006)));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(4) "31st"
+string(3) "1st"
+string(3) "2nd"
+string(3) "3rd"
+string(3) "4th"
+string(3) "5th"
+string(3) "6th"
+string(3) "7th"
+string(3) "8th"
+string(3) "9th"
+string(4) "10th"
+string(4) "11th"
+string(4) "12th"
+string(4) "13th"
+string(4) "14th"
+string(4) "15th"
+string(4) "16th"
+string(4) "17th"
+string(4) "18th"
+string(4) "19th"
+string(4) "20th"
+string(4) "21st"
+string(4) "22nd"
+string(4) "23rd"
+string(4) "24th"
+string(4) "25th"
+string(4) "26th"
+string(4) "27th"
+string(4) "28th"
+string(4) "29th"
+string(4) "30th"
+string(4) "31st"
+Done
diff --git a/ext/date/tests/004.phpt b/ext/date/tests/004.phpt
new file mode 100644
index 0000000..33e1fc7
--- /dev/null
+++ b/ext/date/tests/004.phpt
@@ -0,0 +1,73 @@
+--TEST--
+date() format params
+--FILE--
+<?php
+
+date_default_timezone_set("UTC");
+$tz = array("UTC", "Asia/Jerusalem", "America/Chicago", "Europe/London");
+$t = mktime(0, 0, 0, 6, 27, 2006);
+
+foreach ($tz as $zone) {
+ date_default_timezone_set($zone);
+
+ var_dump(date("w", $t));
+ var_dump(date("z", $t));
+ var_dump(date("n", $t));
+ var_dump(date("t", $t));
+ var_dump(date("L", $t));
+ var_dump(date("a", $t));
+ var_dump(date("B", $t));
+ var_dump(date("g", $t));
+ var_dump(date("G", $t));
+ var_dump(date("Z", $t));
+ var_dump(date("U", $t));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "2"
+string(3) "177"
+string(1) "6"
+string(2) "30"
+string(1) "0"
+string(2) "am"
+string(3) "041"
+string(2) "12"
+string(1) "0"
+string(1) "0"
+string(10) "1151366400"
+string(1) "2"
+string(3) "177"
+string(1) "6"
+string(2) "30"
+string(1) "0"
+string(2) "am"
+string(3) "041"
+string(1) "3"
+string(1) "3"
+string(5) "10800"
+string(10) "1151366400"
+string(1) "1"
+string(3) "176"
+string(1) "6"
+string(2) "30"
+string(1) "0"
+string(2) "pm"
+string(3) "041"
+string(1) "7"
+string(2) "19"
+string(6) "-18000"
+string(10) "1151366400"
+string(1) "2"
+string(3) "177"
+string(1) "6"
+string(2) "30"
+string(1) "0"
+string(2) "am"
+string(3) "041"
+string(1) "1"
+string(1) "1"
+string(4) "3600"
+string(10) "1151366400"
+Done
diff --git a/ext/date/tests/005.phpt b/ext/date/tests/005.phpt
new file mode 100644
index 0000000..911aea7
--- /dev/null
+++ b/ext/date/tests/005.phpt
@@ -0,0 +1,44 @@
+--TEST--
+idate() and invalid params
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$t = mktime(0,0,0, 6, 27, 2006);
+
+var_dump(idate());
+var_dump(idate(1,1,1));
+
+var_dump(idate(1,1));
+var_dump(idate(""));
+var_dump(idate(0));
+
+var_dump(idate("B", $t));
+var_dump(idate("[", $t));
+var_dump(idate("'"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: idate() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: idate() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+int(41)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+Done
diff --git a/ext/date/tests/006.phpt b/ext/date/tests/006.phpt
new file mode 100644
index 0000000..19a044a
--- /dev/null
+++ b/ext/date/tests/006.phpt
@@ -0,0 +1,32 @@
+--TEST--
+checkdate() tests
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+var_dump(checkdate());
+var_dump(checkdate(1,1,1));
+
+var_dump(checkdate(2,29,2006));
+var_dump(checkdate(31,6,2006));
+var_dump(checkdate(1,1,32768));
+var_dump(checkdate(1,1,32767));
+
+var_dump(checkdate(-1,1,2006));
+var_dump(checkdate(1,-1,2006));
+var_dump(checkdate(1,1,-1));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/date/tests/007.phpt b/ext/date/tests/007.phpt
new file mode 100644
index 0000000..567777e
--- /dev/null
+++ b/ext/date/tests/007.phpt
@@ -0,0 +1,100 @@
+--TEST--
+localtime() tests
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$t = mktime(0,0,0, 6, 27, 2006);
+var_dump(localtime(1,1,1));
+
+var_dump(localtime());
+var_dump(localtime($t));
+var_dump(localtime($t, true));
+var_dump(localtime($t, false));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(9) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(%d)
+ [5]=>
+ int(%d)
+ [6]=>
+ int(%d)
+ [7]=>
+ int(%d)
+ [8]=>
+ int(%d)
+}
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(27)
+ [4]=>
+ int(5)
+ [5]=>
+ int(106)
+ [6]=>
+ int(2)
+ [7]=>
+ int(177)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(27)
+ ["tm_mon"]=>
+ int(5)
+ ["tm_year"]=>
+ int(106)
+ ["tm_wday"]=>
+ int(2)
+ ["tm_yday"]=>
+ int(177)
+ ["tm_isdst"]=>
+ int(0)
+}
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(27)
+ [4]=>
+ int(5)
+ [5]=>
+ int(106)
+ [6]=>
+ int(2)
+ [7]=>
+ int(177)
+ [8]=>
+ int(0)
+}
+Done
diff --git a/ext/date/tests/008.phpt b/ext/date/tests/008.phpt
new file mode 100644
index 0000000..ce6be18
--- /dev/null
+++ b/ext/date/tests/008.phpt
@@ -0,0 +1,66 @@
+--TEST--
+getdate() tests
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$t = mktime(0,0,0, 6, 27, 2006);
+var_dump(getdate(1,1));
+
+var_dump(getdate($t));
+var_dump(getdate());
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d
+bool(false)
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(0)
+ ["mday"]=>
+ int(27)
+ ["wday"]=>
+ int(2)
+ ["mon"]=>
+ int(6)
+ ["year"]=>
+ int(2006)
+ ["yday"]=>
+ int(177)
+ ["weekday"]=>
+ string(7) "Tuesday"
+ ["month"]=>
+ string(4) "June"
+ [0]=>
+ int(1151366400)
+}
+array(11) {
+ ["seconds"]=>
+ int(%d)
+ ["minutes"]=>
+ int(%d)
+ ["hours"]=>
+ int(%d)
+ ["mday"]=>
+ int(%d)
+ ["wday"]=>
+ int(%d)
+ ["mon"]=>
+ int(%d)
+ ["year"]=>
+ int(%d)
+ ["yday"]=>
+ int(%d)
+ ["weekday"]=>
+ string(%d) "%s"
+ ["month"]=>
+ string(%d) "%s"
+ [0]=>
+ int(%d)
+}
+Done
diff --git a/ext/date/tests/009.phpt b/ext/date/tests/009.phpt
new file mode 100644
index 0000000..3697ed6
--- /dev/null
+++ b/ext/date/tests/009.phpt
@@ -0,0 +1,50 @@
+--TEST--
+strftime() and gmstrftime() tests
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip posix only test.');
+if (!function_exists('strftime')) die("skip, strftime not available");
+?>
+--FILE--
+<?php
+date_default_timezone_set('Asia/Jerusalem');
+
+$t = mktime(0,0,0, 6, 27, 2006);
+
+var_dump(strftime());
+
+var_dump(strftime(""));
+var_dump(strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
+var_dump(strftime("%%q %%a", $t));
+var_dump(strftime("%q", $t));
+var_dump(strftime("blah", $t));
+
+var_dump(gmstrftime());
+
+var_dump(gmstrftime(""));
+var_dump(gmstrftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
+var_dump(gmstrftime("%%q %%a", $t));
+var_dump(gmstrftime("%q", $t));
+var_dump(gmstrftime("blah", $t));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+bool(false)
+%unicode|string%(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s
+%s %"
+%unicode|string%(5) "%q %a"
+%unicode|string%(%d) "%s"
+%unicode|string%(4) "blah"
+
+Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+bool(false)
+%unicode|string%(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s
+%s %"
+%unicode|string%(5) "%q %a"
+%unicode|string%(%d) "%s"
+%unicode|string%(4) "blah"
+Done
diff --git a/ext/date/tests/009_win32.phpt b/ext/date/tests/009_win32.phpt
new file mode 100644
index 0000000..cbdc8b7
--- /dev/null
+++ b/ext/date/tests/009_win32.phpt
@@ -0,0 +1,50 @@
+--TEST--
+strftime() and gmstrftime() tests
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') die('skip only windows test.');
+if (!function_exists('strftime')) die("skip, strftime not available");
+?>
+--FILE--
+<?php
+date_default_timezone_set('Asia/Jerusalem');
+
+$t = mktime(0,0,0, 6, 27, 2006);
+
+var_dump(strftime());
+
+var_dump(strftime(""));
+
+var_dump(strftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t));
+
+var_dump(strftime("%%q %%a", $t));
+
+var_dump(strftime("blah", $t));
+
+var_dump(gmstrftime());
+
+var_dump(gmstrftime(""));
+
+var_dump(gmstrftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t));
+
+var_dump(gmstrftime("%%q %%a", $t));
+
+var_dump(gmstrftime("blah", $t));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+bool(false)
+string(%d) "Tue Tuesday Jun June 06/27/06 00:00:00 27 00 12 178 06 00 AM 00 26 26 2 06/27/06 00:00:00 06 2006 %s"
+string(5) "%q %a"
+string(4) "blah"
+
+Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+bool(false)
+string(%d) "Mon Monday Jun June 06/26/06 21:00:00 26 21 09 177 06 00 PM 00 26 26 1 06/26/06 21:00:00 06 2006 %s"
+string(5) "%q %a"
+string(4) "blah"
+Done
diff --git a/ext/date/tests/010.phpt b/ext/date/tests/010.phpt
new file mode 100644
index 0000000..58b0ce8
--- /dev/null
+++ b/ext/date/tests/010.phpt
@@ -0,0 +1,67 @@
+--TEST--
+timezone_abbreviations_list() tests
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+ $timezone_abbreviations = timezone_abbreviations_list();
+ var_dump($timezone_abbreviations["utc"]);
+ echo "Done\n";
+?>
+--EXPECTF--
+array(6) {
+ [0]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(0)
+ ["timezone_id"]=>
+ string(13) "Etc/Universal"
+ }
+ [1]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(0)
+ ["timezone_id"]=>
+ string(7) "Etc/UTC"
+ }
+ [2]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(0)
+ ["timezone_id"]=>
+ string(8) "Etc/Zulu"
+ }
+ [3]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(0)
+ ["timezone_id"]=>
+ string(3) "GMT"
+ }
+ [4]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(0)
+ ["timezone_id"]=>
+ string(3) "UTC"
+ }
+ [5]=>
+ array(3) {
+ ["dst"]=>
+ bool(false)
+ ["offset"]=>
+ int(0)
+ ["timezone_id"]=>
+ string(3) "UTC"
+ }
+}
+Done
diff --git a/ext/date/tests/011.phpt b/ext/date/tests/011.phpt
new file mode 100644
index 0000000..460e8c9
--- /dev/null
+++ b/ext/date/tests/011.phpt
@@ -0,0 +1,22 @@
+--TEST--
+timezone_name_from_abbr() tests
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+var_dump(timezone_name_from_abbr());
+var_dump(timezone_name_from_abbr("CET"));
+var_dump(timezone_name_from_abbr("AEST"));
+var_dump(timezone_name_from_abbr("", 3600));
+var_dump(timezone_name_from_abbr("", 3600, 0));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+string(13) "Europe/Berlin"
+bool(false)
+bool(false)
+string(12) "Europe/Paris"
+Done
diff --git a/ext/date/tests/012.phpt b/ext/date/tests/012.phpt
new file mode 100644
index 0000000..0577f18
--- /dev/null
+++ b/ext/date/tests/012.phpt
@@ -0,0 +1,57 @@
+--TEST--
+date_isodate_set() tests
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$dto = date_create("2006-12-12");
+var_dump(date_isodate_set($dto, 2006, 2, 15));
+var_dump($dto->format("Y/m/d H:i:s"));
+var_dump(date_isodate_set($dto, 2006));
+var_dump($dto->format("Y/m/d H:i:s"));
+var_dump(date_isodate_set($dto, 2006, 5));
+var_dump($dto->format("Y/m/d H:i:s"));
+var_dump(date_isodate_set($dto, 2006, 100, 15));
+var_dump($dto->format("Y/m/d H:i:s"));
+var_dump(date_isodate_set($dto, 2006, 100, 15, 10));
+var_dump($dto->format("Y/m/d H:i:s"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2006-01-23 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+string(19) "2006/01/23 00:00:00"
+
+Warning: date_isodate_set() expects at least 3 parameters, 2 given in %s on line %d
+bool(false)
+string(19) "2006/01/23 00:00:00"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2006-01-30 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+string(19) "2006/01/30 00:00:00"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2007-12-10 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+string(19) "2007/12/10 00:00:00"
+
+Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+string(19) "2007/12/10 00:00:00"
+Done
diff --git a/ext/date/tests/013.phpt b/ext/date/tests/013.phpt
new file mode 100644
index 0000000..60fac24
--- /dev/null
+++ b/ext/date/tests/013.phpt
@@ -0,0 +1,57 @@
+--TEST--
+date_date_set() tests
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$dto = date_create("2006-12-12");
+var_dump($dto);
+var_dump($dto->format("Y.m.d H:i:s"));
+var_dump(date_date_set());
+var_dump($dto->format("Y.m.d H:i:s"));
+var_dump(date_date_set($dto, 2006, 5));
+var_dump($dto->format("Y.m.d H:i:s"));
+var_dump(date_date_set($dto, 2006, 2, 15));
+var_dump($dto->format("Y.m.d H:i:s"));
+var_dump(date_date_set($dto, 2006, 24, 60));
+var_dump($dto->format("Y.m.d H:i:s"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2006-12-12 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+string(19) "2006.12.12 00:00:00"
+
+Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d
+bool(false)
+string(19) "2006.12.12 00:00:00"
+
+Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d
+bool(false)
+string(19) "2006.12.12 00:00:00"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2006-02-15 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+string(19) "2006.02.15 00:00:00"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2008-01-29 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+string(19) "2008.01.29 00:00:00"
+Done
diff --git a/ext/date/tests/014.phpt b/ext/date/tests/014.phpt
new file mode 100644
index 0000000..be08477
--- /dev/null
+++ b/ext/date/tests/014.phpt
@@ -0,0 +1,38 @@
+--TEST--
+timezone_offset_get() tests
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$dto = date_create("2006-12-12");
+var_dump($dto);
+
+$dtz = date_timezone_get($dto);
+var_dump($dtz);
+
+var_dump(timezone_offset_get());
+var_dump(timezone_offset_get($dtz, $dto));
+var_dump(timezone_offset_get($dto, $dtz));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2006-12-12 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+object(DateTimeZone)#%d (0) {
+}
+
+Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+int(0)
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+Done
diff --git a/ext/date/tests/015.phpt b/ext/date/tests/015.phpt
new file mode 100644
index 0000000..46001ad
--- /dev/null
+++ b/ext/date/tests/015.phpt
@@ -0,0 +1,21 @@
+--TEST--
+timezone object reference handling
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+$dto = new DateTime();
+$tzold = $dto->getTimezone();
+var_dump($tzold->getName());
+$dto->setTimezone(new DateTimeZone('US/Eastern'));
+var_dump($tzold->getName());
+var_dump($dto->getTimezone()->getName());
+unset($dto);
+var_dump($tzold->getName());
+echo "Done\n";
+?>
+--EXPECTF--
+string(3) "UTC"
+string(3) "UTC"
+string(10) "US/Eastern"
+string(3) "UTC"
+Done
diff --git a/ext/date/tests/DateInterval_format.phpt b/ext/date/tests/DateInterval_format.phpt
new file mode 100644
index 0000000..c144f58
--- /dev/null
+++ b/ext/date/tests/DateInterval_format.phpt
@@ -0,0 +1,71 @@
+--TEST--
+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 <danielc@php.net>
+# TestFest 2010 BKTK
+--SKIPIF--
+<?php if (!method_exists('DateInterval', 'format')) die("skip: method doesn't exist"); ?>
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$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('Y=%Y') . "\n";
+echo $interval->format('M=%M') . "\n";
+echo $interval->format('D=%D') . "\n";
+echo $interval->format('H=%H') . "\n";
+echo $interval->format('I=%I') . "\n";
+echo $interval->format('S=%S') . "\n";
+echo $interval->format('R=%R') . "\n";
+
+echo $interval->format('y=%y') . "\n";
+echo $interval->format('m=%m') . "\n";
+echo $interval->format('d=%d') . "\n";
+echo $interval->format('h=%h') . "\n";
+echo $interval->format('i=%i') . "\n";
+echo $interval->format('s=%s') . "\n";
+echo $interval->format('r=%r') . "\n";
+
+echo "\n";
+
+$interval = $date2->diff($date1);
+
+echo $interval->format('inverted R=%R') . "\n";
+echo $interval->format('inverted r=%r') . "\n";
+
+echo "\n";
+
+echo $interval->format('%=%%') . "\n";
+
+// Invalid valid format character does not raise warnings.
+echo $interval->format('x=%x') . "\n";
+
+?>
+--EXPECT--
+Y=01
+M=02
+D=03
+H=04
+I=05
+S=06
+R=+
+y=1
+m=2
+d=3
+h=4
+i=5
+s=6
+r=
+
+inverted R=-
+inverted r=-
+
+%=%
+x=%x
diff --git a/ext/date/tests/DateInterval_format_a.phpt b/ext/date/tests/DateInterval_format_a.phpt
new file mode 100644
index 0000000..48c6cc1
--- /dev/null
+++ b/ext/date/tests/DateInterval_format_a.phpt
@@ -0,0 +1,24 @@
+--TEST--
+DateInterval::format(), %a
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+# TestFest 2010 BKTK
+--INI--
+date.timezone=UTC
+--SKIPIF--
+<?php
+if (!method_exists('DateInterval', 'format')) die("skip: method doesn't exist");
+?>
+--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
diff --git a/ext/date/tests/DatePeriod_wrong_constructor.phpt b/ext/date/tests/DatePeriod_wrong_constructor.phpt
new file mode 100644
index 0000000..62e6aa9
--- /dev/null
+++ b/ext/date/tests/DatePeriod_wrong_constructor.phpt
@@ -0,0 +1,17 @@
+--TEST--
+DatePeriod: Test wrong __construct parameter
+--CREDITS--
+Havard Eide <nucleuz@gmail.com>
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+new DatePeriod();
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'Exception' with message 'DatePeriod::__construct(): This constructor accepts either (DateTime, DateInterval, int) OR (DateTime, DateInterval, DateTime) OR (string) as arguments.' in %s:%d
+Stack trace:
+#0 %s(%d): DatePeriod->__construct()
+#1 {main}
+ thrown in %s on line %d \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_clone_basic1.phpt b/ext/date/tests/DateTimeZone_clone_basic1.phpt
new file mode 100644
index 0000000..6de5d4b
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_clone_basic1.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test clone on DateTimeZone objects
+--FILE--
+<?php
+
+//Set the default time zone
+date_default_timezone_set('Europe/London');
+
+echo "*** Testing clone on DateTime objects ***\n";
+
+// Create a DateTimeZone object..
+$orig = new DateTimeZone("GMT");
+
+// ..create a clone of it ..Clone
+$clone = clone $orig;
+
+var_dump($orig);
+var_dump($clone);
+
+if ($clone != $orig) {
+ echo "TEST FAILED : objects not equal\n";
+}else if ($clone === $orig) {
+ echo "TEST FAILED : objects identical\n";
+} else {
+ echo "TEST PASSED : Objects equal but not indetical\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone on DateTime objects ***
+object(DateTimeZone)#%d (0) {
+}
+object(DateTimeZone)#%d (0) {
+}
+TEST PASSED : Objects equal but not indetical
+===DONE===
+
+
diff --git a/ext/date/tests/DateTimeZone_clone_basic2.phpt b/ext/date/tests/DateTimeZone_clone_basic2.phpt
new file mode 100644
index 0000000..a499510
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_clone_basic2.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Testing clone on objects whoose class derived from DateTimeZone class
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+class DateTimeZoneExt1 extends DateTimeZone {
+ public $property1 = 99;
+ public $property2 = "Hello";
+}
+
+class DateTimeZoneExt2 extends DateTimeZoneExt1 {
+ public $property3 = true;
+ public $property4 = 10.5;
+}
+
+echo "*** Testing clone on objects whoose class derived from DateTimeZone class ***\n";
+
+$d1 = new DateTimeZoneExt1("Europe/London");
+var_dump($d1);
+$d1_clone = clone $d1;
+var_dump($d1_clone);
+
+$d2 = new DateTimeZoneExt2("Europe/London");
+var_dump($d2);
+$d2_clone = clone $d2;
+var_dump($d2_clone);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone on objects whoose class derived from DateTimeZone class ***
+object(DateTimeZoneExt1)#%d (2) {
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+}
+object(DateTimeZoneExt1)#%d (2) {
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+}
+object(DateTimeZoneExt2)#%d (4) {
+ ["property3"]=>
+ bool(true)
+ ["property4"]=>
+ float(10.5)
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+}
+object(DateTimeZoneExt2)#%d (4) {
+ ["property3"]=>
+ bool(true)
+ ["property4"]=>
+ float(10.5)
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+}
+===DONE===
diff --git a/ext/date/tests/DateTimeZone_clone_basic3.phpt b/ext/date/tests/DateTimeZone_clone_basic3.phpt
new file mode 100644
index 0000000..e85f42e
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_clone_basic3.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test clone of DateTimeZOne objects
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing clone on DateTime objects ***\n";
+
+echo "\n-- Create a DateTimeZone object --\n";
+$d1 = new DateTimeZone("Europe/London");
+var_dump($d1);
+echo "\n-- Add some properties --\n";
+$d1->property1 = 99;
+$d1->property2 = "Hello";
+var_dump($d1);
+echo "\n-- clone it --\n";
+$d1_clone = clone $d1;
+var_dump($d1_clone);
+echo "\n-- Add some more properties --\n";
+$d1_clone->property3 = true;
+$d1_clone->property4 = 10.5;
+var_dump($d1_clone);
+echo "\n-- clone it --\n";
+$d2_clone = clone $d1_clone;
+var_dump($d2_clone);
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone on DateTime objects ***
+
+-- Create a DateTimeZone object --
+object(DateTimeZone)#%d (0) {
+}
+
+-- Add some properties --
+object(DateTimeZone)#%d (2) {
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+}
+
+-- clone it --
+object(DateTimeZone)#%d (2) {
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+}
+
+-- Add some more properties --
+object(DateTimeZone)#%d (4) {
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+ ["property3"]=>
+ bool(true)
+ ["property4"]=>
+ float(10.5)
+}
+
+-- clone it --
+object(DateTimeZone)#%d (4) {
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+ ["property3"]=>
+ bool(true)
+ ["property4"]=>
+ float(10.5)
+}
+===DONE===
diff --git a/ext/date/tests/DateTimeZone_clone_basic4.phpt b/ext/date/tests/DateTimeZone_clone_basic4.phpt
new file mode 100644
index 0000000..a295b91
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_clone_basic4.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test clone of DateTimeZone derived objects with __clone magic method
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+class DateTimeZoneExt1 extends DateTimeZone {
+ public function __clone() {
+ echo "-- DateTimeExt1 __clone magic method called --\n";
+ }
+}
+
+echo "*** Testing clone of objects derived from DateTimeZone class with __clone magic method***\n";
+
+$d1 = new DateTimeZoneExt1("America/New_York");
+$d1_clone = clone $d1;
+
+//verify clone by calling method on new object
+var_dump( $d1_clone->getName() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone of objects derived from DateTimeZone class with __clone magic method***
+-- DateTimeExt1 __clone magic method called --
+string(16) "America/New_York"
+===DONE===
diff --git a/ext/date/tests/DateTimeZone_compare_basic1.phpt b/ext/date/tests/DateTimeZone_compare_basic1.phpt
new file mode 100644
index 0000000..f3648cb
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_compare_basic1.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test of compare object handler for DateTime objects
+--FILE--
+<?php
+
+// NB: DateTimeZone class does not define a customized compare class handler so standard object handler will be used
+
+echo "Simple test for DateTimeZone compare object handler\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+class DateTimeZoneExt1 extends DateTimeZone {
+}
+
+class DateTimeZoneExt2 extends DateTimeZone{
+ public $foo = "Hello";
+ private $bar = 99;
+}
+
+class DateTimeZoneExt3 extends DateTimeZoneExt2 {
+}
+
+$obj1 = new DateTimeZone("Europe/London");
+$obj2 = new DateTimeZoneExt1("Europe/London");
+$obj3 = new DateTimeZoneExt2("Europe/London");
+$obj4 = new DateTimeZoneExt3("Europe/London");
+
+echo "\n-- All the following tests should compare equal --\n";
+var_dump($obj1 == $obj1);
+echo "\n-- All the following tests should compare NOT equal --\n";
+var_dump($obj1 == $obj2);
+var_dump($obj1 == $obj3);
+var_dump($obj1 == $obj4);
+var_dump($obj2 == $obj3);
+var_dump($obj2 == $obj4);
+var_dump($obj3 == $obj4);
+
+?>
+===DONE===
+--EXPECT--
+Simple test for DateTimeZone compare object handler
+
+-- All the following tests should compare equal --
+bool(true)
+
+-- All the following tests should compare NOT equal --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_construct_basic.phpt b/ext/date/tests/DateTimeZone_construct_basic.phpt
new file mode 100644
index 0000000..b681e8f
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_construct_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test new DateTimeZone() : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTimeZone::__construct ( string $timezone )
+ * Description: Returns new DateTimeZone object
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing new DateTimeZone() : basic functionality ***\n";
+
+var_dump( new DateTimeZone("GMT") );
+var_dump( new DateTimeZone("Europe/London") );
+var_dump( new DateTimeZone("America/Los_Angeles") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing new DateTimeZone() : basic functionality ***
+object(DateTimeZone)#%d (0) {
+}
+object(DateTimeZone)#%d (0) {
+}
+object(DateTimeZone)#%d (0) {
+}
+===DONE===
diff --git a/ext/date/tests/DateTimeZone_construct_error.phpt b/ext/date/tests/DateTimeZone_construct_error.phpt
new file mode 100644
index 0000000..8ffe322
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_construct_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test new DateTimeZone() : error conditions
+--FILE--
+<?php
+/* Prototype : DateTimeZone::__construct ( string $timezone )
+ * Description: Returns new DateTimeZone object
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+echo "*** Testing DateTimeZone() : error conditions ***\n";
+
+echo "\n-- Testing new DateTimeZone() with more than expected no. of arguments --\n";
+$timezone = "GMT";
+$extra_arg = 99;
+var_dump( new DateTimeZone($timezone, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTimeZone() : error conditions ***
+
+-- Testing new DateTimeZone() with more than expected no. of arguments --
+
+Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() expects exactly 1 parameter, 2 given' in %s:%d
+Stack trace:
+#0 %s(%d): DateTimeZone->__construct('GMT', 99)
+#1 {main}
+ thrown in %s on line %d
+ \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_construct_variation1.phpt b/ext/date/tests/DateTimeZone_construct_variation1.phpt
new file mode 100644
index 0000000..65e575e
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_construct_variation1.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Test DateTime::__construct() function : usage variation - Passing unexpected values to first argument $timezone.
+--FILE--
+<?php
+/* Prototype : DateTimeZone::__construct ( string $timezone )
+ * Description: Returns new DateTimeZone object
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing DateTime::__construct() : usage variation - unexpected values to first argument \$timezone***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+foreach($inputs as $variation =>$timezone) {
+ echo "\n-- $variation --\n";
+ try {
+ var_dump( new DateTimezone($timezone) );
+ } catch(Exception $e) {
+ $msg = $e->getMessage();
+ echo "FAILED: " . $msg . "\n";
+ }
+
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::__construct() : usage variation - unexpected values to first argument $timezone***
+
+-- int 0 --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (0)
+
+-- int 1 --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1)
+
+-- int 12345 --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (12345)
+
+-- int -12345 --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (-12345)
+
+-- float 10.5 --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (10.5)
+
+-- float -10.5 --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (-10.5)
+
+-- float .5 --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (0.5)
+
+-- empty array --
+FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given
+
+-- int indexed array --
+FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given
+
+-- associative array --
+FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given
+
+-- nested arrays --
+FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given
+
+-- uppercase NULL --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
+
+-- lowercase null --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
+
+-- lowercase true --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1)
+
+-- lowercase false --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
+
+-- uppercase TRUE --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1)
+
+-- uppercase FALSE --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
+
+-- empty string DQ --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
+
+-- empty string SQ --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
+
+-- string DQ --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (string)
+
+-- string SQ --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (string)
+
+-- mixed case string --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (sTrInG)
+
+-- heredoc --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (hello world)
+
+-- instance of classWithToString --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone (Class A object)
+
+-- instance of classWithoutToString --
+FAILED: DateTimeZone::__construct() expects parameter 1 to be string, object given
+
+-- undefined var --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
+
+-- unset var --
+FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
+
+-- resource --
+FAILED: DateTimeZone::__construct() expects parameter 1 to be string, resource given
+===DONE===
diff --git a/ext/date/tests/DateTimeZone_extends_basic1.phpt b/ext/date/tests/DateTimeZone_extends_basic1.phpt
new file mode 100644
index 0000000..afc2ed6
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_extends_basic1.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test DateTimeZone class inheritance
+--FILE--
+<?php
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing basic DateTimeZone inheritance() ***\n";
+
+class DateTimeZoneExt extends DateTimeZone
+{
+ public function __toString()
+ {
+ return parent::getName();
+ }
+}
+
+echo "\n-- Create an instance of DateTimeZoneExt --\n";
+$d = new DateTimeZoneExt("America/Los_Angeles");
+
+echo "\n-- Invoke __toString --\n";
+echo $d . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing basic DateTimeZone inheritance() ***
+
+-- Create an instance of DateTimeZoneExt --
+
+-- Invoke __toString --
+America/Los_Angeles
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_getName_basic1.phpt b/ext/date/tests/DateTimeZone_getName_basic1.phpt
new file mode 100644
index 0000000..de5ca65
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_getName_basic1.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test DateTimeZone::getName() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public string DateTimeZone::getName ( void )
+ * Description: Returns the name of the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_name_get()
+ */
+
+echo "*** Testing DateTimeZone::getName() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$tz1 = new DateTimeZone("Europe/London");
+var_dump( $tz1->getName() );
+
+$tz2 = new DateTimeZone("America/New_York");
+var_dump( $tz2->getName() );
+
+$tz3 = new DateTimeZone("America/Los_Angeles");
+var_dump( $tz3->getName() );
+
+?>
+===DONE===
+--EXPECT--
+*** Testing DateTimeZone::getName() : basic functionality ***
+string(13) "Europe/London"
+string(16) "America/New_York"
+string(19) "America/Los_Angeles"
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_getName_error.phpt b/ext/date/tests/DateTimeZone_getName_error.phpt
new file mode 100644
index 0000000..0a87b10
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_getName_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test DateTimeZone::getName() function : error conditions
+--FILE--
+<?php
+/* Prototype : public string DateTimeZone::getName ( void )
+ * Description: Returns the name of the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_name_get()
+ */
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$tz = new DateTimeZone("Europe/London");
+
+echo "*** Testing DateTimeZone::getName() : error conditions ***\n";
+
+echo "\n-- Testing DateTimeZone::getName() function with more than expected no. of arguments --\n";
+$extra_arg = 99;
+var_dump( $tz->getName($extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTimeZone::getName() : error conditions ***
+
+-- Testing DateTimeZone::getName() function with more than expected no. of arguments --
+
+Warning: DateTimeZone::getName() expects exactly 0 parameters, 1 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTimeZone_getOffset_basic1.phpt b/ext/date/tests/DateTimeZone_getOffset_basic1.phpt
new file mode 100644
index 0000000..ea3c280
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_getOffset_basic1.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test DateTimeZone::getOffset() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int DateTimeZone::getOffset ( DateTime $datetime )
+ * Description: Returns the timezone offset from GMT
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_offset_get()
+ */
+
+echo "*** Testing DateTimeZone::getOffset() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$tz1 = new DateTimeZone("Europe/London");
+$date = new DateTime("GMT");
+var_dump( $tz1->getOffset($date) );
+
+$tz2 = new DateTimeZone("America/New_York");
+var_dump( $tz2->getOffset($date) );
+
+$tz3 = new DateTimeZone("America/Los_Angeles");
+var_dump( $tz3->getOffset($date) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTimeZone::getOffset() : basic functionality ***
+%rint\(0\)|int\(3600\)%r
+%rint\(-18000\)|int\(-14400\)%r
+%rint\(-28800\)|int\(-25200\)%r
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_getOffset_error.phpt b/ext/date/tests/DateTimeZone_getOffset_error.phpt
new file mode 100644
index 0000000..56e45b7
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_getOffset_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test DateTimeZone::getOffset() function : error conditions
+--FILE--
+<?php
+/* Prototype : int DateTimeZone::getOffset ( DateTime $datetime )
+ * Description: Returns the timezone offset from GMT
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_offset_get()
+ */
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$tz = new DateTimeZone("Europe/London");
+$date = date_create("GMT");
+
+echo "*** Testing DateTimeZone::getOffset() : error conditions ***\n";
+
+echo "\n-- Testing DateTimeZone::getOffset() function with zero arguments --\n";
+var_dump( $tz->getOffset() );
+
+echo "\n-- Testing DateTimeZone::getOffset() function with more than expected no. of arguments --\n";
+$extra_arg = 99;
+var_dump( $tz->getOffset($date, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTimeZone::getOffset() : error conditions ***
+
+-- Testing DateTimeZone::getOffset() function with zero arguments --
+
+Warning: DateTimeZone::getOffset() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing DateTimeZone::getOffset() function with more than expected no. of arguments --
+
+Warning: DateTimeZone::getOffset() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_getOffset_variation1.phpt b/ext/date/tests/DateTimeZone_getOffset_variation1.phpt
new file mode 100644
index 0000000..a86d5e1
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_getOffset_variation1.phpt
@@ -0,0 +1,252 @@
+--TEST--
+Test DateTimeZone::getOffset() function : usage variation - Passing unexpected values to first argument $datetime.
+--FILE--
+<?php
+/* Prototype : int DateTimeZone::getOffset ( DateTime $datetime )
+ * Description: Returns the timezone offset from GMT
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_offset_get()
+ */
+
+echo "*** Testing DateTimeZone::getOffset() : usage variation - unexpected values to first argument \$datetime***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$timezone = new DateTimezone("Europe/London");
+
+foreach($inputs as $variation =>$datetime) {
+ echo "\n-- $variation --\n";
+ var_dump( $timezone->getOffset($datetime) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTimeZone::getOffset() : usage variation - unexpected values to first argument $datetime***
+
+-- int 0 --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
new file mode 100644
index 0000000..f3640d1
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test DateTimeZone::getTransitions() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array DateTimeZone::getTransitions ()
+ * Description: Returns all transitions for the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_transitions_get()
+ */
+
+echo "*** Testing DateTimeZone::getTransitions() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+// Create a DateTimeZone object
+$tz = new DateTimeZone("Europe/London");
+
+$tran = $tz->getTransitions();
+
+if (!is_array($tran)) {
+ echo "TEST FAILED: Expected an array\n";
+}
+
+echo "\n-- Total number of transitions: " . count($tran). " --\n";
+
+echo "\n-- Format a sample entry for Spring 1963 --\n";
+var_dump( $tran[97] );
+
+?>
+===DONE===
+--EXPECT--
+*** Testing DateTimeZone::getTransitions() : basic functionality ***
+
+-- Total number of transitions: 243 --
+
+-- Format a sample entry for Spring 1963 --
+array(5) {
+ ["ts"]=>
+ int(-213228000)
+ ["time"]=>
+ string(24) "1963-03-31T02:00:00+0000"
+ ["offset"]=>
+ int(3600)
+ ["isdst"]=>
+ bool(true)
+ ["abbr"]=>
+ string(3) "BST"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_getTransitions_error.phpt b/ext/date/tests/DateTimeZone_getTransitions_error.phpt
new file mode 100644
index 0000000..bfcd224
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_getTransitions_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test DateTimeZone::getTransitions() function : error conditions
+--FILE--
+<?php
+/* Prototype : array DateTimeZone::getTransitions ([ int $timestamp_begin [, int $timestamp_end ]] )
+ * Description: Returns all transitions for the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_transitions_get()
+ */
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$tz = new DateTimeZone("Europe/London");
+
+echo "*** Testing DateTimeZone::getTransitions() : error conditions ***\n";
+
+echo "\n-- Testing DateTimeZone::getTransitions() function with more than expected no. of arguments --\n";
+$timestamp_begin = mktime(0, 0, 0, 1, 1, 1972);
+$timestamp_end = mktime(0, 0, 0, 1, 1, 1975);
+$extra_arg = 99;
+
+var_dump( $tz->getTransitions($timestamp_begin, $timestamp_end, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTimeZone::getTransitions() : error conditions ***
+
+-- Testing DateTimeZone::getTransitions() function with more than expected no. of arguments --
+
+Warning: DateTimeZone::getTransitions() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
new file mode 100644
index 0000000..015c9e8
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test DateTimeZone::listAbbreviations() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array DateTimeZone::listAbbreviations ( void )
+ * Description: Returns associative array containing dst, offset and the timezone name
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_abbreviations_list
+ */
+
+echo "*** Testing DateTimeZone::listAbbreviations() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$abbr = DateTimeZone::listAbbreviations();
+
+var_dump( gettype($abbr) );
+var_dump( count($abbr) );
+
+echo "\n-- Format a sample entry --\n";
+var_dump( $abbr["acst"] );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTimeZone::listAbbreviations() : basic functionality ***
+string(5) "array"
+int(%d)
+
+-- Format a sample entry --
+array(4) {
+ [0]=>
+ array(3) {
+ ["dst"]=>
+ bool(true)
+ ["offset"]=>
+ int(-14400)
+ ["timezone_id"]=>
+ string(18) "America/Porto_Acre"
+ }
+ [1]=>
+ array(3) {
+ ["dst"]=>
+ bool(true)
+ ["offset"]=>
+ int(-14400)
+ ["timezone_id"]=>
+ string(16) "America/Eirunepe"
+ }
+ [2]=>
+ array(3) {
+ ["dst"]=>
+ bool(true)
+ ["offset"]=>
+ int(-14400)
+ ["timezone_id"]=>
+ string(18) "America/Rio_Branco"
+ }
+ [3]=>
+ array(3) {
+ ["dst"]=>
+ bool(true)
+ ["offset"]=>
+ int(-14400)
+ ["timezone_id"]=>
+ string(11) "Brazil/Acre"
+ }
+}
+===DONE===
diff --git a/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt b/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt
new file mode 100644
index 0000000..7eebfa8
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test DateTimeZone::listIdentifiers function : basic functionality
+--FILE--
+<?php
+/* Prototype : array DateTimeZone::listIdentifiers ( void )
+ * Description: Returns numerically index array with all timezone identifiers
+ * Source code: ext/date/php_date.c
+ * Alias to functions: timezone_identifiers_list
+ */
+
+echo "*** Testing DateTimeZone::listIdentifiers() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$zones = DateTimeZone::listIdentifiers();
+echo "Check return tpe is ARRAY\n";
+var_dump(is_array($zones));
+
+echo "Check array contains some common timezones\n";
+var_dump(in_array("Europe/London", $zones));
+var_dump(in_array("America/New_York", $zones));
+var_dump(in_array("UTC", $zones));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing DateTimeZone::listIdentifiers() : basic functionality ***
+Check return tpe is ARRAY
+bool(true)
+Check array contains some common timezones
+bool(true)
+bool(true)
+bool(true)
+===DONE===
+ \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_serialize.phpt b/ext/date/tests/DateTimeZone_serialize.phpt
new file mode 100644
index 0000000..08dd934
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_serialize.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test serialization of DateTimeZone objects
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+$tz1 = new DateTimeZone("America/New_York");
+var_dump( $tz1 );
+$serialized = serialize($tz1);
+var_dump($serialized);
+
+$tz2 = unserialize($serialized);
+var_dump($tz2);
+// Try to use unserialzied object
+var_dump( $tz2->getName() );
+
+?>
+===DONE===
+--EXPECTF--
+object(DateTimeZone)#%d (0) {
+}
+string(24) "O:12:"DateTimeZone":0:{}"
+object(DateTimeZone)#%d (0) {
+}
+
+Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTimeZone_verify.phpt b/ext/date/tests/DateTimeZone_verify.phpt
new file mode 100644
index 0000000..3ca0913
--- /dev/null
+++ b/ext/date/tests/DateTimeZone_verify.phpt
@@ -0,0 +1,111 @@
+--TEST--
+Test DateTimeZone class registration
+--FILE--
+<?php
+
+echo "*** Verify DateTimeZone class ***\n";
+
+echo "Verify DateTimeZone class registered OK\n";
+$class = new ReflectionClass('DateTimeZone');
+var_dump($class);
+
+echo "..and get names of all its methods\n";
+$methods = $class->getMethods();
+var_dump($methods);
+
+echo "..and get names of all its class constants\n";
+$constants = $class->getConstants();
+var_dump($constants);
+?>
+===DONE===
+--EXPECTF--
+*** Verify DateTimeZone class ***
+Verify DateTimeZone class registered OK
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(12) "DateTimeZone"
+}
+..and get names of all its methods
+array(7) {
+ [0]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(11) "__construct"
+ ["class"]=>
+ string(12) "DateTimeZone"
+ }
+ [1]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(7) "getName"
+ ["class"]=>
+ string(12) "DateTimeZone"
+ }
+ [2]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(9) "getOffset"
+ ["class"]=>
+ string(12) "DateTimeZone"
+ }
+ [3]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(14) "getTransitions"
+ ["class"]=>
+ string(12) "DateTimeZone"
+ }
+ [4]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(11) "getLocation"
+ ["class"]=>
+ string(12) "DateTimeZone"
+ }
+ [5]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(17) "listAbbreviations"
+ ["class"]=>
+ string(12) "DateTimeZone"
+ }
+ [6]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(15) "listIdentifiers"
+ ["class"]=>
+ string(12) "DateTimeZone"
+ }
+}
+..and get names of all its class constants
+array(14) {
+ ["AFRICA"]=>
+ int(1)
+ ["AMERICA"]=>
+ int(2)
+ ["ANTARCTICA"]=>
+ int(4)
+ ["ARCTIC"]=>
+ int(8)
+ ["ASIA"]=>
+ int(16)
+ ["ATLANTIC"]=>
+ int(32)
+ ["AUSTRALIA"]=>
+ int(64)
+ ["EUROPE"]=>
+ int(128)
+ ["INDIAN"]=>
+ int(256)
+ ["PACIFIC"]=>
+ int(512)
+ ["UTC"]=>
+ int(1024)
+ ["ALL"]=>
+ int(2047)
+ ["ALL_WITH_BC"]=>
+ int(4095)
+ ["PER_COUNTRY"]=>
+ int(4096)
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTime_add-dates.phpt b/ext/date/tests/DateTime_add-dates.phpt
new file mode 100644
index 0000000..48c821f
--- /dev/null
+++ b/ext/date/tests/DateTime_add-dates.phpt
@@ -0,0 +1,29 @@
+--TEST--
+DateTime::add() -- dates
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-dates.inc';
+
+?>
+--EXPECT--
+test__7: ADD: 2009-01-07 00:00:00 EST + P+0Y0M7DT0H0M0S = **2009-01-14 00:00:00 EST**
+test_years_positive__7_by_0_day: ADD: 2000-02-07 00:00:00 EST + P+7Y0M0DT0H0M0S = **2007-02-07 00:00:00 EST**
+test_years_positive__7_by_1_day: ADD: 2000-02-07 00:00:00 EST + P+7Y0M1DT0H0M0S = **2007-02-08 00:00:00 EST**
+test_years_positive__6_shy_1_day: ADD: 2000-02-07 00:00:00 EST + P+6Y11M30DT0H0M0S = **2007-02-06 00:00:00 EST**
+test_years_positive__7_by_1_month: ADD: 2000-02-07 00:00:00 EST + P+7Y1M0DT0H0M0S = **2007-03-07 00:00:00 EST**
+test_years_positive__6_shy_1_month: ADD: 2000-02-07 00:00:00 EST + P+6Y11M0DT0H0M0S = **2007-01-07 00:00:00 EST**
+test_years_positive__7_by_1_month_split_newyear: ADD: 1999-12-07 00:00:00 EST + P+7Y1M0DT0H0M0S = **2007-01-07 00:00:00 EST**
+test_years_positive__6_shy_1_month_split_newyear: ADD: 2000-01-07 00:00:00 EST + P+6Y11M0DT0H0M0S = **2006-12-07 00:00:00 EST**
+test_negative__7: ADD: 2009-01-14 00:00:00 EST + P-0Y0M7DT0H0M0S = **2009-01-07 00:00:00 EST**
+test_years_negative__7_by_0_day: ADD: 2007-02-07 00:00:00 EST + P-7Y0M0DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_negative__7_by_1_day: ADD: 2007-02-08 00:00:00 EST + P-7Y0M1DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_negative__6_shy_1_day: ADD: 2007-02-06 00:00:00 EST + P-6Y11M28DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_negative__7_by_1_month: ADD: 2007-03-07 00:00:00 EST + P-7Y1M0DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_negative__6_shy_1_month: ADD: 2007-01-07 00:00:00 EST + P-6Y11M0DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_negative__7_by_1_month_split_newyear: ADD: 2007-01-07 00:00:00 EST + P-7Y1M0DT0H0M0S = **1999-12-07 00:00:00 EST**
+test_years_negative__6_shy_1_month_split_newyear: ADD: 2006-12-07 00:00:00 EST + P-6Y11M0DT0H0M0S = **2000-01-07 00:00:00 EST**
diff --git a/ext/date/tests/DateTime_add-fall-type2-type2.phpt b/ext/date/tests/DateTime_add-fall-type2-type2.phpt
new file mode 100644
index 0000000..894ff60
--- /dev/null
+++ b/ext/date/tests/DateTime_add-fall-type2-type2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DateTime::add() -- fall type2 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-fall-type2-type2.inc';
+
+?>
+--EXPECT--
+test_time_fall_type2_prev_type2_prev: ADD: 2010-10-04 02:18:48 EDT + P+0Y1M2DT16H19M40S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_prev_type2_dt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_prev_type2_redodt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_prev_type2_redost: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT7H36M16S = **2010-11-07 02:14:44 EDT**
+test_time_fall_type2_prev_type2_st: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT9H38M27S = **2010-11-07 04:16:55 EDT**
+test_time_fall_type2_prev_type2_post: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EDT**
+test_time_fall_type2_dt_type2_prev: ADD: 2010-11-07 00:10:20 EDT + P-0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_dt_type2_dt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT0H5M15S = **2010-11-07 00:15:35 EDT**
+test_time_fall_type2_dt_type2_redodt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_dt_type2_redost: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT2H4M24S = **2010-11-07 02:14:44 EDT**
+test_time_fall_type2_dt_type2_st: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT4H6M35S = **2010-11-07 04:16:55 EDT**
+test_time_fall_type2_dt_type2_post: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M1DT20H49M39S = **2010-11-08 20:59:59 EDT**
+test_time_fall_type2_redodt_type2_prev: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_redodt_type2_dt: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_redodt_type2_redodt: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT0H3M2S = **2010-11-07 01:15:35 EDT**
+test_time_fall_type2_redodt_type2_redost: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT1H2M11S = **2010-11-07 02:14:44 EDT**
+test_time_fall_type2_redodt_type2_st: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT3H4M22S = **2010-11-07 04:16:55 EDT**
+test_time_fall_type2_redodt_type2_post: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M1DT19H47M26S = **2010-11-08 20:59:59 EDT**
+test_time_fall_type2_redost_type2_prev: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT7H36M16S = **2010-11-06 17:38:28 EST**
+test_time_fall_type2_redost_type2_dt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT2H4M24S = **2010-11-06 23:10:20 EST**
+test_time_fall_type2_redost_type2_redodt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT1H2M11S = **2010-11-07 00:12:33 EST**
+test_time_fall_type2_redost_type2_redost: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT0H2M10S = **2010-11-07 01:16:54 EST**
+test_time_fall_type2_redost_type2_st: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_redost_type2_post: ADD: 2010-11-07 01:14:44 EST + P+0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_st_type2_prev: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT9H38M27S = **2010-11-06 17:38:28 EST**
+test_time_fall_type2_st_type2_dt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT4H6M35S = **2010-11-06 23:10:20 EST**
+test_time_fall_type2_st_type2_redodt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT3H4M22S = **2010-11-07 00:12:33 EST**
+test_time_fall_type2_st_type2_redost: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_st_type2_st: ADD: 2010-11-07 03:16:55 EST + P+0Y0M0DT2H3M1S = **2010-11-07 05:19:56 EST**
+test_time_fall_type2_st_type2_post: ADD: 2010-11-07 03:16:55 EST + P+0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type2_prev: ADD: 2010-11-08 19:59:59 EST + P-0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EST**
+test_time_fall_type2_post_type2_dt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT20H49M39S = **2010-11-06 23:10:20 EST**
+test_time_fall_type2_post_type2_redodt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT19H47M26S = **2010-11-07 00:12:33 EST**
+test_time_fall_type2_post_type2_redost: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_post_type2_st: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_post_type2_post: ADD: 2010-11-08 18:57:55 EST + P+0Y0M0DT1H2M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_dtsec_type2_stsec: ADD: 2010-11-07 01:59:59 EDT + P+0Y0M0DT0H0M1S = **2010-11-07 02:00:00 EDT**
+test_time_fall_type2_stsec_type2_dtsec: ADD: 2010-11-07 01:00:00 EST + P-0Y0M0DT0H0M1S = **2010-11-07 00:59:59 EST**
diff --git a/ext/date/tests/DateTime_add-fall-type2-type3.phpt b/ext/date/tests/DateTime_add-fall-type2-type3.phpt
new file mode 100644
index 0000000..077dd56
--- /dev/null
+++ b/ext/date/tests/DateTime_add-fall-type2-type3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::add() -- fall type2 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-fall-type2-type3.inc';
+
+?>
+--EXPECT--
+test_time_fall_type2_prev_type3_prev: ADD: 2010-10-04 02:18:48 EDT + P+0Y1M2DT16H19M40S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_prev_type3_dt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_prev_type3_redodt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_prev_type3_redost: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT7H36M16S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_prev_type3_st: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT9H38M27S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_prev_type3_post: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_dt_type3_prev: ADD: 2010-11-07 00:10:20 EDT + P-0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_dt_type3_dt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT0H5M15S = **2010-11-07 00:15:35 EDT**
+test_time_fall_type2_dt_type3_redodt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_dt_type3_redost: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT2H4M24S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_dt_type3_st: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT4H6M35S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_dt_type3_post: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M1DT20H49M39S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_redodt_type3_prev: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_redodt_type3_dt: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_redodt_type3_redodt: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT0H3M2S = **2010-11-07 01:15:35 EDT**
+test_time_fall_type2_redodt_type3_redost: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT1H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_redodt_type3_st: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT3H4M22S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_redodt_type3_post: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M1DT19H47M26S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_redost_type3_prev: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT7H36M16S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_redost_type3_dt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT2H4M24S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_redost_type3_redodt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT1H2M11S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redost_type3_redost: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT0H2M10S = **2010-11-07 01:16:54 EST**
+test_time_fall_type2_redost_type3_st: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_redost_type3_post: ADD: 2010-11-07 01:14:44 EST + P+0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_st_type3_prev: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT9H38M27S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_st_type3_dt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT4H6M35S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_st_type3_redodt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT3H4M22S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_st_type3_redost: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_st_type3_st: ADD: 2010-11-07 03:16:55 EST + P+0Y0M0DT2H3M1S = **2010-11-07 05:19:56 EST**
+test_time_fall_type2_st_type3_post: ADD: 2010-11-07 03:16:55 EST + P+0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type3_prev: ADD: 2010-11-08 19:59:59 EST + P-0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_post_type3_dt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT20H49M39S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_post_type3_redodt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT19H47M26S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_post_type3_redost: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_post_type3_st: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_post_type3_post: ADD: 2010-11-08 18:57:55 EST + P+0Y0M0DT1H2M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_dtsec_type3_stsec: ADD: 2010-11-07 01:59:59 EDT + P+0Y0M0DT0H0M1S = **2010-11-07 01:00:00 EST**
+test_time_fall_type2_stsec_type3_dtsec: ADD: 2010-11-07 01:00:00 EST + P-0Y0M0DT0H0M1S = **2010-11-07 01:59:59 EDT**
diff --git a/ext/date/tests/DateTime_add-fall-type3-type2.phpt b/ext/date/tests/DateTime_add-fall-type3-type2.phpt
new file mode 100644
index 0000000..0588cbf
--- /dev/null
+++ b/ext/date/tests/DateTime_add-fall-type3-type2.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::add() -- fall type3 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-fall-type3-type2.inc';
+
+?>
+--EXPECT--
+test_time_fall_type3_prev_type2_prev: ADD: 2010-10-04 02:18:48 EDT + P+0Y1M2DT16H19M40S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type2_dt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_prev_type2_redodt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_prev_type2_redost: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT7H36M16S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_prev_type2_st: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT9H38M27S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_prev_type2_post: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_dt_type2_prev: ADD: 2010-11-07 00:10:20 EDT + P-0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_dt_type2_dt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT0H5M15S = **2010-11-07 00:15:35 EDT**
+test_time_fall_type3_dt_type2_redodt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_dt_type2_redost: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT2H4M24S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_dt_type2_st: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT4H6M35S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_dt_type2_post: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M1DT20H49M39S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_redodt_type2_prev: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_redodt_type2_dt: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_redodt_type2_redodt: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT0H3M2S = **2010-11-07 01:15:35 EDT**
+test_time_fall_type3_redodt_type2_redost: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT1H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redodt_type2_st: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT3H4M22S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_redodt_type2_post: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M1DT19H47M26S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_redost_type2_prev: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT7H36M16S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_redost_type2_dt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT2H4M24S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_redost_type2_redodt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT1H2M11S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redost_type2_redost: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT0H2M10S = **2010-11-07 01:16:54 EST**
+test_time_fall_type3_redost_type2_st: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_redost_type2_post: ADD: 2010-11-07 01:14:44 EST + P+0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_st_type2_prev: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT9H38M27S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_st_type2_dt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT4H6M35S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_st_type2_redodt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT3H4M22S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_st_type2_redost: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_st_type2_st: ADD: 2010-11-07 03:16:55 EST + P+0Y0M0DT2H3M1S = **2010-11-07 05:19:56 EST**
+test_time_fall_type3_st_type2_post: ADD: 2010-11-07 03:16:55 EST + P+0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type2_prev: ADD: 2010-11-08 19:59:59 EST + P-0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_post_type2_dt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT20H49M39S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_post_type2_redodt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT19H47M26S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_post_type2_redost: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_post_type2_st: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_post_type2_post: ADD: 2010-11-08 18:57:55 EST + P+0Y0M0DT1H2M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_dtsec_type2_stsec: ADD: 2010-11-07 01:59:59 EDT + P+0Y0M0DT0H0M1S = **2010-11-07 01:00:00 EST**
+test_time_fall_type3_stsec_type2_dtsec: ADD: 2010-11-07 01:00:00 EST + P-0Y0M0DT0H0M1S = **2010-11-07 01:59:59 EDT**
diff --git a/ext/date/tests/DateTime_add-fall-type3-type3.phpt b/ext/date/tests/DateTime_add-fall-type3-type3.phpt
new file mode 100644
index 0000000..2431552
--- /dev/null
+++ b/ext/date/tests/DateTime_add-fall-type3-type3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::add() -- fall type3 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-fall-type3-type3.inc';
+
+?>
+--EXPECT--
+test_time_fall_type3_prev_type3_prev: ADD: 2010-10-04 02:18:48 EDT + P+0Y1M2DT16H19M40S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type3_dt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_prev_type3_redodt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_prev_type3_redost: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT7H36M16S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_prev_type3_st: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT9H38M27S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_prev_type3_post: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_dt_type3_prev: ADD: 2010-11-07 00:10:20 EDT + P-0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_dt_type3_dt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT0H5M15S = **2010-11-07 00:15:35 EDT**
+test_time_fall_type3_dt_type3_redodt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_dt_type3_redost: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT2H4M24S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_dt_type3_st: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT4H6M35S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_dt_type3_post: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M1DT20H49M39S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_redodt_type3_prev: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_redodt_type3_dt: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_redodt_type3_redodt: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT0H3M2S = **2010-11-07 01:15:35 EDT**
+test_time_fall_type3_redodt_type3_redost: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT1H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redodt_type3_st: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT3H4M22S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_redodt_type3_post: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M1DT19H47M26S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_redost_type3_prev: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT7H36M16S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_redost_type3_dt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT2H4M24S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_redost_type3_redodt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT1H2M11S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redost_type3_redost: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT0H2M10S = **2010-11-07 01:16:54 EST**
+test_time_fall_type3_redost_type3_st: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_redost_type3_post: ADD: 2010-11-07 01:14:44 EST + P+0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_st_type3_prev: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT9H38M27S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_st_type3_dt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT4H6M35S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_st_type3_redodt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT3H4M22S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_st_type3_redost: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_st_type3_st: ADD: 2010-11-07 03:16:55 EST + P+0Y0M0DT2H3M1S = **2010-11-07 05:19:56 EST**
+test_time_fall_type3_st_type3_post: ADD: 2010-11-07 03:16:55 EST + P+0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type3_prev: ADD: 2010-11-08 19:59:59 EST + P-0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_post_type3_dt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT20H49M39S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_post_type3_redodt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT19H47M26S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_post_type3_redost: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_post_type3_st: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_post_type3_post: ADD: 2010-11-08 18:57:55 EST + P+0Y0M0DT1H2M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_dtsec_type3_stsec: ADD: 2010-11-07 01:59:59 EDT + P+0Y0M0DT0H0M1S = **2010-11-07 01:00:00 EST**
+test_time_fall_type3_stsec_type3_dtsec: ADD: 2010-11-07 01:00:00 EST + P-0Y0M0DT0H0M1S = **2010-11-07 01:59:59 EDT**
diff --git a/ext/date/tests/DateTime_add-february.phpt b/ext/date/tests/DateTime_add-february.phpt
new file mode 100644
index 0000000..8e47c0e
--- /dev/null
+++ b/ext/date/tests/DateTime_add-february.phpt
@@ -0,0 +1,77 @@
+--TEST--
+DateTime::add() -- february
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-february.inc';
+
+?>
+--EXPECT--
+test_bug_49081__1: ADD: 2010-03-01 00:00:00 EST + P+0Y0M30DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081__2: ADD: 2010-03-01 00:00:00 EST + P+0Y1M0DT0H0M0S = **2010-04-01 00:00:00 EDT**
+test_bug_49081__3: ADD: 2010-03-31 00:00:00 EDT + P+0Y0M1DT0H0M0S = **2010-04-01 00:00:00 EDT**
+test_bug_49081__4: ADD: 2010-03-31 00:00:00 EDT + P+0Y0M29DT0H0M0S = **2010-04-29 00:00:00 EDT**
+test_bug_49081__5: ADD: 2010-03-31 00:00:00 EDT + P+0Y0M30DT0H0M0S = **2010-04-30 00:00:00 EDT**
+test_bug_49081__6: ADD: 2010-03-30 00:00:00 EDT + P+0Y1M0DT0H0M0S = **2010-04-30 00:00:00 EDT**
+test_bug_49081__7: ADD: 2010-03-29 00:00:00 EDT + P+0Y1M1DT0H0M0S = **2010-04-30 00:00:00 EDT**
+test_bug_49081__8: ADD: 2010-01-01 00:00:00 EST + P+0Y0M28DT0H0M0S = **2010-01-29 00:00:00 EST**
+test_bug_49081__9: ADD: 2010-01-01 00:00:00 EST + P+0Y0M29DT0H0M0S = **2010-01-30 00:00:00 EST**
+test_bug_49081__10: ADD: 2010-01-01 00:00:00 EST + P+0Y0M30DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081__11: ADD: 2010-01-01 00:00:00 EST + P+0Y1M0DT0H0M0S = **2010-02-01 00:00:00 EST**
+test_bug_49081__12: ADD: 2010-01-31 00:00:00 EST + P+0Y0M1DT0H0M0S = **2010-02-01 00:00:00 EST**
+test_bug_49081__13: ADD: 2010-01-31 00:00:00 EST + P+0Y0M27DT0H0M0S = **2010-02-27 00:00:00 EST**
+test_bug_49081__14: ADD: 2010-01-31 00:00:00 EST + P+0Y0M28DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081__15: ADD: 2010-01-30 00:00:00 EST + P+0Y0M29DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081__16: ADD: 2010-01-29 00:00:00 EST + P+0Y0M30DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081__17: ADD: 2010-01-28 00:00:00 EST + P+0Y1M0DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081__18: ADD: 2010-01-27 00:00:00 EST + P+0Y1M1DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081__19: ADD: 2010-01-01 00:00:00 EST + P+0Y2M0DT0H0M0S = **2010-03-01 00:00:00 EST**
+test_bug_49081__20: ADD: 2010-01-31 00:00:00 EST + P+0Y0M29DT0H0M0S = **2010-03-01 00:00:00 EST**
+test_bug_49081__21: ADD: 2010-01-31 00:00:00 EST + P+0Y1M24DT0H0M0S = **2010-03-27 00:00:00 EDT**
+test_bug_49081__22: ADD: 2010-01-31 00:00:00 EST + P+0Y1M25DT0H0M0S = **2010-03-28 00:00:00 EDT**
+test_bug_49081__23: ADD: 2010-01-31 00:00:00 EST + P+0Y1M26DT0H0M0S = **2010-03-29 00:00:00 EDT**
+test_bug_49081__24: ADD: 2010-01-31 00:00:00 EST + P+0Y1M27DT0H0M0S = **2010-03-30 00:00:00 EDT**
+test_bug_49081__25: ADD: 2010-01-31 00:00:00 EST + P+0Y2M0DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081__26: ADD: 2010-01-30 00:00:00 EST + P+0Y2M1DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081__27: ADD: 2009-01-01 00:00:00 EST + P+0Y0M30DT0H0M0S = **2009-01-31 00:00:00 EST**
+test_bug_49081__28: ADD: 2010-02-28 00:00:00 EST + P+0Y0M27DT0H0M0S = **2010-03-27 00:00:00 EDT**
+test_bug_49081__29: ADD: 2010-02-28 00:00:00 EST + P+0Y1M0DT0H0M0S = **2010-03-28 00:00:00 EDT**
+test_bug_49081__30: ADD: 2010-02-28 00:00:00 EST + P+0Y1M1DT0H0M0S = **2010-03-29 00:00:00 EDT**
+test_bug_49081__31: ADD: 2010-02-27 00:00:00 EST + P+0Y1M0DT0H0M0S = **2010-03-27 00:00:00 EDT**
+test_bug_49081__32: ADD: 2010-02-26 00:00:00 EST + P+0Y1M1DT0H0M0S = **2010-03-27 00:00:00 EDT**
+test_bug_49081_negative__1: ADD: 2010-03-31 00:00:00 EDT + P-0Y0M30DT0H0M0S = **2010-03-01 00:00:00 EST**
+test_bug_49081_negative__2: ADD: 2010-04-01 00:00:00 EDT + P-0Y1M0DT0H0M0S = **2010-03-01 00:00:00 EST**
+test_bug_49081_negative__3: ADD: 2010-04-01 00:00:00 EDT + P-0Y0M1DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081_negative__4: ADD: 2010-04-29 00:00:00 EDT + P-0Y0M29DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081_negative__5: ADD: 2010-04-30 00:00:00 EDT + P-0Y0M30DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081_negative__6: ADD: 2010-04-30 00:00:00 EDT + P-0Y1M0DT0H0M0S = **2010-03-30 00:00:00 EDT**
+test_bug_49081_negative__7: ADD: 2010-04-30 00:00:00 EDT + P-0Y1M1DT0H0M0S = **2010-03-29 00:00:00 EDT**
+test_bug_49081_negative__8: ADD: 2010-01-29 00:00:00 EST + P-0Y0M28DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081_negative__9: ADD: 2010-01-30 00:00:00 EST + P-0Y0M29DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081_negative__10: ADD: 2010-01-31 00:00:00 EST + P-0Y0M30DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081_negative__11: ADD: 2010-02-01 00:00:00 EST + P-0Y1M0DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081_negative__12: ADD: 2010-02-01 00:00:00 EST + P-0Y0M1DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__13: ADD: 2010-02-27 00:00:00 EST + P-0Y0M27DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__14: ADD: 2010-02-28 00:00:00 EST + P-0Y0M28DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__15: ADD: 2010-02-28 00:00:00 EST + P-0Y0M29DT0H0M0S = **2010-01-30 00:00:00 EST**
+test_bug_49081_negative__16: ADD: 2010-02-28 00:00:00 EST + P-0Y0M30DT0H0M0S = **2010-01-29 00:00:00 EST**
+test_bug_49081_negative__17: ADD: 2010-02-28 00:00:00 EST + P-0Y1M0DT0H0M0S = **2010-01-28 00:00:00 EST**
+test_bug_49081_negative__18: ADD: 2010-02-28 00:00:00 EST + P-0Y1M1DT0H0M0S = **2010-01-27 00:00:00 EST**
+test_bug_49081_negative__19: ADD: 2010-03-01 00:00:00 EST + P-0Y2M0DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081_negative__20: ADD: 2010-03-01 00:00:00 EST + P-0Y1M1DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__21: ADD: 2010-03-27 00:00:00 EDT + P-0Y1M27DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__22: ADD: 2010-03-28 00:00:00 EDT + P-0Y1M28DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__23: ADD: 2010-03-29 00:00:00 EDT + P-0Y1M29DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__24: ADD: 2010-03-30 00:00:00 EDT + P-0Y1M30DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__25: ADD: 2010-03-31 00:00:00 EDT + P-0Y2M0DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__26: ADD: 2010-03-31 00:00:00 EDT + P-0Y2M1DT0H0M0S = **2010-01-30 00:00:00 EST**
+test_bug_49081_negative__27: ADD: 2009-01-31 00:00:00 EST + P-0Y0M30DT0H0M0S = **2009-01-01 00:00:00 EST**
+test_bug_49081_negative__28: ADD: 2010-03-27 00:00:00 EDT + P-0Y0M27DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081_negative__29: ADD: 2010-03-28 00:00:00 EDT + P-0Y1M0DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081_negative__30: ADD: 2010-03-29 00:00:00 EDT + P-0Y1M1DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081_negative__31: ADD: 2010-03-27 00:00:00 EDT + P-0Y1M0DT0H0M0S = **2010-02-27 00:00:00 EST**
+test_bug_49081_negative__32: ADD: 2010-03-27 00:00:00 EDT + P-0Y1M1DT0H0M0S = **2010-02-26 00:00:00 EST**
diff --git a/ext/date/tests/DateTime_add-massive.phpt b/ext/date/tests/DateTime_add-massive.phpt
new file mode 100644
index 0000000..ca5bef9
--- /dev/null
+++ b/ext/date/tests/DateTime_add-massive.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DateTime::add() -- massive
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-massive.inc';
+
+?>
+--EXPECT--
+test_massive_positive: ADD: -333333-01-01 16:18:02 EST + P+666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 EST**
+test_massive_negative: ADD: 333333-01-01 16:18:02 EST + P-666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 EST**
diff --git a/ext/date/tests/DateTime_add-spring-type2-type2.phpt b/ext/date/tests/DateTime_add-spring-type2-type2.phpt
new file mode 100644
index 0000000..e522873
--- /dev/null
+++ b/ext/date/tests/DateTime_add-spring-type2-type2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DateTime::add() -- spring type2 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-spring-type2-type2.inc';
+
+?>
+--EXPECT--
+test_time_spring_type2_prev_type2_prev: ADD: 2010-02-11 02:18:48 EST + P+0Y1M2DT16H19M40S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_prev_type2_st: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_prev_type2_dt: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT7H38M27S = **2010-03-14 02:16:55 EST**
+test_time_spring_type2_prev_type2_post: ADD: 2010-03-13 18:38:28 EST + P+0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EST**
+test_time_spring_type2_st_type2_prev: ADD: 2010-03-14 00:10:20 EST + P-0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_st_type2_st: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT0H5M15S = **2010-03-14 00:15:35 EST**
+test_time_spring_type2_st_type2_dt: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT2H6M35S = **2010-03-14 02:16:55 EST**
+test_time_spring_type2_st_type2_post: ADD: 2010-03-14 00:10:20 EST + P+0Y0M1DT18H49M39S = **2010-03-15 18:59:59 EST**
+test_time_spring_type2_dt_type2_prev: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT7H38M27S = **2010-03-13 19:38:28 EDT**
+test_time_spring_type2_dt_type2_st: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT2H6M35S = **2010-03-14 01:10:20 EDT**
+test_time_spring_type2_dt_type2_dt: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M0DT2H3M1S = **2010-03-14 05:19:56 EDT**
+test_time_spring_type2_dt_type2_post: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_post_type2_prev: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EDT**
+test_time_spring_type2_post_type2_st: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT18H49M39S = **2010-03-14 01:10:20 EDT**
+test_time_spring_type2_post_type2_dt: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_post_type2_post: ADD: 2010-03-15 18:57:55 EDT + P+0Y0M0DT1H2M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_stsec_type2_dtsec: ADD: 2010-03-14 01:59:59 EST + P+0Y0M0DT0H0M1S = **2010-03-14 02:00:00 EST**
+test_time_spring_type2_dtsec_type2_stsec: ADD: 2010-03-14 03:00:00 EDT + P-0Y0M0DT0H0M1S = **2010-03-14 02:59:59 EDT**
diff --git a/ext/date/tests/DateTime_add-spring-type2-type3.phpt b/ext/date/tests/DateTime_add-spring-type2-type3.phpt
new file mode 100644
index 0000000..5544651
--- /dev/null
+++ b/ext/date/tests/DateTime_add-spring-type2-type3.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::add() -- spring type2 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-spring-type2-type3.inc';
+
+?>
+--EXPECT--
+test_time_spring_type2_prev_type3_prev: ADD: 2010-02-11 02:18:48 EST + P+0Y1M2DT16H19M40S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_prev_type3_st: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_prev_type3_dt: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT7H38M27S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_prev_type3_post: ADD: 2010-03-13 18:38:28 EST + P+0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_st_type3_prev: ADD: 2010-03-14 00:10:20 EST + P-0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_st_type3_st: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT0H5M15S = **2010-03-14 00:15:35 EST**
+test_time_spring_type2_st_type3_dt: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT2H6M35S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_st_type3_post: ADD: 2010-03-14 00:10:20 EST + P+0Y0M1DT18H49M39S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_dt_type3_prev: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT7H38M27S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_dt_type3_st: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT2H6M35S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_dt_type3_dt: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M0DT2H3M1S = **2010-03-14 05:19:56 EDT**
+test_time_spring_type2_dt_type3_post: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_post_type3_prev: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_post_type3_st: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT18H49M39S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_post_type3_dt: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_post_type3_post: ADD: 2010-03-15 18:57:55 EDT + P+0Y0M0DT1H2M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_stsec_type3_dtsec: ADD: 2010-03-13 01:59:59 EST + P+0Y0M0DT0H0M1S = **2010-03-15 03:00:00 EDT**
+test_time_spring_type2_dtsec_type3_stsec: ADD: 2010-03-15 03:00:00 EDT + P-0Y0M0DT0H0M1S = **2010-03-15 01:59:59 EST**
diff --git a/ext/date/tests/DateTime_add-spring-type3-type2.phpt b/ext/date/tests/DateTime_add-spring-type3-type2.phpt
new file mode 100644
index 0000000..fe75a5c
--- /dev/null
+++ b/ext/date/tests/DateTime_add-spring-type3-type2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::add() -- spring type3 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-spring-type3-type2.inc';
+
+?>
+--EXPECT--
+test_time_spring_type3_prev_type2_prev: ADD: 2010-02-11 02:18:48 EST + P+0Y1M2DT16H19M40S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_prev_type2_st: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_prev_type2_dt: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT7H38M27S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_prev_type2_post: ADD: 2010-03-13 18:38:28 EST + P+0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_st_type2_prev: ADD: 2010-03-14 00:10:20 EST + P-0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_st_type2_st: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT0H5M15S = **2010-03-14 00:15:35 EST**
+test_time_spring_type3_st_type2_dt: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT2H6M35S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_st_type2_post: ADD: 2010-03-14 00:10:20 EST + P+0Y0M1DT18H49M39S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_dt_type2_prev: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT7H38M27S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_dt_type2_st: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT2H6M35S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_dt_type2_dt: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M0DT2H3M1S = **2010-03-14 05:19:56 EDT**
+test_time_spring_type3_dt_type2_post: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_post_type2_prev: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_post_type2_st: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT18H49M39S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_post_type2_dt: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_post_type2_post: ADD: 2010-03-15 18:57:55 EDT + P+0Y0M0DT1H2M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_stsec_type2_dtsec: ADD: 2010-03-13 01:59:59 EST + P+0Y0M0DT0H0M1S = **2010-03-15 03:00:00 EDT**
+test_time_spring_type3_dtsec_type2_stsec: ADD: 2010-03-15 03:00:00 EDT + P-0Y0M0DT0H0M1S = **2010-03-15 01:59:59 EST**
diff --git a/ext/date/tests/DateTime_add-spring-type3-type3.phpt b/ext/date/tests/DateTime_add-spring-type3-type3.phpt
new file mode 100644
index 0000000..b2a5c3e
--- /dev/null
+++ b/ext/date/tests/DateTime_add-spring-type3-type3.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::add() -- spring type3 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
+require 'DateTime_data-spring-type3-type3.inc';
+
+?>
+--EXPECT--
+test_time_spring_type3_prev_type3_prev: ADD: 2010-02-11 02:18:48 EST + P+0Y1M2DT16H19M40S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_prev_type3_st: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_prev_type3_dt: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT7H38M27S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_prev_type3_post: ADD: 2010-03-13 18:38:28 EST + P+0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_st_type3_prev: ADD: 2010-03-14 00:10:20 EST + P-0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_st_type3_st: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT0H5M15S = **2010-03-14 00:15:35 EST**
+test_time_spring_type3_st_type3_dt: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT2H6M35S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_st_type3_post: ADD: 2010-03-14 00:10:20 EST + P+0Y0M1DT18H49M39S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_dt_type3_prev: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT7H38M27S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_dt_type3_st: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT2H6M35S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_dt_type3_dt: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M0DT2H3M1S = **2010-03-14 05:19:56 EDT**
+test_time_spring_type3_dt_type3_post: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_post_type3_prev: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_post_type3_st: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT18H49M39S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_post_type3_dt: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_post_type3_post: ADD: 2010-03-15 18:57:55 EDT + P+0Y0M0DT1H2M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_stsec_type3_dtsec: ADD: 2010-03-13 01:59:59 EST + P+0Y0M0DT0H0M1S = **2010-03-15 03:00:00 EDT**
+test_time_spring_type3_dtsec_type3_stsec: ADD: 2010-03-15 03:00:00 EDT + P-0Y0M0DT0H0M1S = **2010-03-15 01:59:59 EST**
diff --git a/ext/date/tests/DateTime_clone_basic1.phpt b/ext/date/tests/DateTime_clone_basic1.phpt
new file mode 100644
index 0000000..cef6621
--- /dev/null
+++ b/ext/date/tests/DateTime_clone_basic1.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test clone on DateTime objects
+--FILE--
+<?php
+
+//Set the default time zone
+date_default_timezone_set('Europe/London');
+
+echo "*** Testing clone on DateTime objects ***\n";
+
+// Create a DateTime object..
+$orig = new DateTime('2008-07-02 14:25:41');
+
+// ..create a clone of it ..Clone
+$clone = clone $orig;
+
+// ..and modify original
+$orig->setTime(22, 41, 50);
+
+echo "Original: " . $orig->format("H:i:s") . "\n";
+echo "Clone: " . $clone->format("H:i:s") . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone on DateTime objects ***
+Original: 22:41:50
+Clone: 14:25:41
+===DONE===
diff --git a/ext/date/tests/DateTime_clone_basic2.phpt b/ext/date/tests/DateTime_clone_basic2.phpt
new file mode 100644
index 0000000..db7ba22
--- /dev/null
+++ b/ext/date/tests/DateTime_clone_basic2.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Test clone of objects whoose class derived from DateTime class
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+class DateTimeExt1 extends DateTime {
+ public $property1 = 99;
+ public $property2 = "Hello";
+
+}
+
+class DateTimeExt2 extends DateTimeExt1 {
+ public $property3 = true;
+ public $property4 = 10.5;
+}
+
+echo "*** Testing clone on objects whoose class derived from DateTime class ***\n";
+
+$d1 = new DateTimeExt1("2009-02-03 12:34:41 GMT");
+var_dump($d1);
+$d1_clone = clone $d1;
+var_dump($d1_clone);
+
+$d2 = new DateTimeExt2("2009-02-03 12:34:41 GMT");
+var_dump($d2);
+$d2_clone = clone $d2;
+var_dump($d2_clone);
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone on objects whoose class derived from DateTime class ***
+object(DateTimeExt1)#%d (5) {
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+object(DateTimeExt1)#%d (5) {
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+object(DateTimeExt2)#%d (7) {
+ ["property3"]=>
+ bool(true)
+ ["property4"]=>
+ float(10.5)
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+object(DateTimeExt2)#%d (7) {
+ ["property3"]=>
+ bool(true)
+ ["property4"]=>
+ float(10.5)
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+===DONE===
diff --git a/ext/date/tests/DateTime_clone_basic3.phpt b/ext/date/tests/DateTime_clone_basic3.phpt
new file mode 100644
index 0000000..43e2898
--- /dev/null
+++ b/ext/date/tests/DateTime_clone_basic3.phpt
@@ -0,0 +1,105 @@
+--TEST--
+Test clone of DateTime objects
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing clone on DateTime objects ***\n";
+
+echo "\n-- Create a DateTime object --\n";
+$d1 = new DateTime("2009-02-03 12:34:41 GMT");
+var_dump($d1);
+echo "\n-- Add some properties --\n";
+$d1->property1 = 99;
+$d1->property2 = "Hello";
+var_dump($d1);
+echo "\n-- clone it --\n";
+$d1_clone = clone $d1;
+var_dump($d1_clone);
+echo "\n-- Add some more properties --\n";
+$d1_clone->property3 = true;
+$d1_clone->property4 = 10.5;
+var_dump($d1_clone);
+echo "\n-- clone it --\n";
+$d2_clone = clone $d1_clone;
+var_dump($d2_clone);
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone on DateTime objects ***
+
+-- Create a DateTime object --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+
+-- Add some properties --
+object(DateTime)#%d (5) {
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+}
+
+-- clone it --
+object(DateTime)#%d (5) {
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+}
+
+-- Add some more properties --
+object(DateTime)#%d (7) {
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+ ["property3"]=>
+ bool(true)
+ ["property4"]=>
+ float(10.5)
+}
+
+-- clone it --
+object(DateTime)#%d (7) {
+ ["date"]=>
+ string(19) "2009-02-03 12:34:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+ ["property1"]=>
+ int(99)
+ ["property2"]=>
+ string(5) "Hello"
+ ["property3"]=>
+ bool(true)
+ ["property4"]=>
+ float(10.5)
+}
+===DONE===
diff --git a/ext/date/tests/DateTime_clone_basic4.phpt b/ext/date/tests/DateTime_clone_basic4.phpt
new file mode 100644
index 0000000..f19f23d
--- /dev/null
+++ b/ext/date/tests/DateTime_clone_basic4.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test clone of DateTime derived objects with __clone magic method
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+class DateTimeExt1 extends DateTime {
+ public function __clone() {
+ echo "-- DateTimeExt1 __clone magic method called --\n";
+ }
+}
+
+echo "*** Testing clone of objects derived from DateTime class with __clone magic method***\n";
+
+$d1 = new DateTimeExt1("2009-02-03 12:34:41 GMT");
+$d1_clone = clone $d1;
+
+//verify clone by calling method on new object
+var_dump( $d1_clone->format( "m.d.y") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone of objects derived from DateTime class with __clone magic method***
+-- DateTimeExt1 __clone magic method called --
+string(8) "02.03.09"
+===DONE===
diff --git a/ext/date/tests/DateTime_compare_basic1.phpt b/ext/date/tests/DateTime_compare_basic1.phpt
new file mode 100644
index 0000000..313dab1
--- /dev/null
+++ b/ext/date/tests/DateTime_compare_basic1.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test of compare object handler for DateTime objects
+--FILE--
+<?php
+
+echo "Simple test for DateTime compare object handler\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+class DateTimeExt1 extends DateTime {
+}
+
+class DateTimeExt2 extends DateTime{
+ public $foo = "Hello";
+ private $bar = 99;
+}
+
+class DateTimeExt3 extends DateTimeExt2 {
+}
+
+$obj1 = new DateTime("2009-02-12 12:47:41 GMT");
+$obj2 = new DateTimeExt1("2009-02-12 12:47:41 GMT");
+$obj3 = new DateTimeExt2("2009-02-12 12:47:41 GMT");
+$obj4 = new DateTimeExt3("2009-02-12 12:47:41 GMT");
+
+echo "\n-- All the following tests should compare equal --\n";
+var_dump($obj1 == $obj1);
+var_dump($obj1 == $obj2);
+var_dump($obj1 == $obj3);
+var_dump($obj1 == $obj4);
+var_dump($obj2 == $obj3);
+var_dump($obj2 == $obj4);
+var_dump($obj3 == $obj4);
+
+date_modify($obj1, "+1 day");
+echo "\n-- The following test should still compare equal --\n";
+var_dump($obj1 == $obj1);
+echo "\n-- All the following tests should now compare NOT equal --\n";
+var_dump($obj1 == $obj2);
+var_dump($obj1 == $obj3);
+var_dump($obj1 == $obj4);
+
+echo "\n-- All the following tests should again compare equal --\n";
+date_modify($obj2, "+1 day");
+date_modify($obj3, "+1 day");
+date_modify($obj4, "+1 day");
+var_dump($obj1 == $obj2);
+var_dump($obj1 == $obj3);
+var_dump($obj1 == $obj4);
+?>
+===DONE===
+--EXPECT--
+Simple test for DateTime compare object handler
+
+-- All the following tests should compare equal --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+-- The following test should still compare equal --
+bool(true)
+
+-- All the following tests should now compare NOT equal --
+bool(false)
+bool(false)
+bool(false)
+
+-- All the following tests should again compare equal --
+bool(true)
+bool(true)
+bool(true)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTime_construct-dst-overlap.phpt b/ext/date/tests/DateTime_construct-dst-overlap.phpt
new file mode 100644
index 0000000..05ed525
--- /dev/null
+++ b/ext/date/tests/DateTime_construct-dst-overlap.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DateTime::__construct() -- fall daylight/standard overlap
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+date_default_timezone_set('America/New_York');
+// PHP defaults to Daylight Saving Time. Ensure consistency in future.
+$d = new DateTime('2011-11-06 01:30:00');
+echo $d->format('P') . "\n";
+
+?>
+--EXPECT--
+-04:00
diff --git a/ext/date/tests/DateTime_construct_basic1.phpt b/ext/date/tests/DateTime_construct_basic1.phpt
new file mode 100644
index 0000000..a865e6b
--- /dev/null
+++ b/ext/date/tests/DateTime_construct_basic1.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test new DateTime() : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTime::__construct ([ string $time="now" [, DateTimeZone $timezone=NULL ]] )
+ * Description: Returns new DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing new DateTime() : basic functionality ***\n";
+
+var_dump( new DateTime('') );
+
+var_dump( new DateTime("GMT") );
+var_dump( new DateTime("2005-07-14 22:30:41") );
+var_dump( new DateTime("2005-07-14 22:30:41 GMT") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing new DateTime() : basic functionality ***
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+===DONE===
diff --git a/ext/date/tests/DateTime_construct_error.phpt b/ext/date/tests/DateTime_construct_error.phpt
new file mode 100644
index 0000000..ef79eb4
--- /dev/null
+++ b/ext/date/tests/DateTime_construct_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test new DateTime() : error conditions
+--FILE--
+<?php
+/* Prototype : DateTime::__construct ([ string $time="now" [, DateTimeZone $timezone=NULL ]] )
+ * Description: Returns new DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+echo "*** Testing date_create() : error conditions ***\n";
+
+echo "\n-- Testing new DateTime() with more than expected no. of arguments --\n";
+$time = "GMT";
+$timezone = timezone_open("GMT");
+$extra_arg = 99;
+var_dump( new DateTime($time, $timezone, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_create() : error conditions ***
+
+-- Testing new DateTime() with more than expected no. of arguments --
+
+Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects at most 2 parameters, 3 given' in %s:%d
+Stack trace:
+#0 %s(%d): DateTime->__construct('GMT', Object(DateTimeZone), 99)
+#1 {main}
+ thrown in %s on line %d \ No newline at end of file
diff --git a/ext/date/tests/DateTime_construct_variation1.phpt b/ext/date/tests/DateTime_construct_variation1.phpt
new file mode 100644
index 0000000..d335b5a
--- /dev/null
+++ b/ext/date/tests/DateTime_construct_variation1.phpt
@@ -0,0 +1,377 @@
+--TEST--
+Test new DateTime() function : usage variation - Passing unexpected values to first argument $time.
+--FILE--
+<?php
+/* Prototype : DateTime::__construct ([ string $time="now" [, DateTimeZone $timezone=NULL ]] )
+ * Description: Returns new DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_create
+ */
+
+echo "*** Testing new DateTime(): usage variation - unexpected values to first argument \$time***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$timezone = new DateTimeZone("Europe/London");
+
+foreach($inputs as $variation =>$time) {
+ echo "\n-- $variation --\n";
+
+ try {
+ var_dump( new DateTime($time) );
+ } catch(Exception $e) {
+ $msg = $e->getMessage();
+ echo "FAILED: " . $msg . "\n";
+ }
+
+ try {
+ var_dump( new DateTime($time, $timezone) );
+ } catch(Exception$e) {
+ $msg = $e->getMessage();
+ echo "FAILED: " . $msg . "\n";
+ }
+};
+
+// closing the resource
+fclose( $file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing new DateTime(): usage variation - unexpected values to first argument $time***
+
+-- int 0 --
+FAILED: DateTime::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character
+FAILED: DateTime::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character
+
+-- int 1 --
+FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character
+FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character
+
+-- int 12345 --
+FAILED: DateTime::__construct(): Failed to parse time string (12345) at position 4 (5): Unexpected character
+FAILED: DateTime::__construct(): Failed to parse time string (12345) at position 4 (5): Unexpected character
+
+-- int -12345 --
+FAILED: DateTime::__construct(): Failed to parse time string (-12345) at position 5 (5): Unexpected character
+FAILED: DateTime::__construct(): Failed to parse time string (-12345) at position 5 (5): Unexpected character
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+FAILED: DateTime::__construct(): Failed to parse time string (-10.5) at position 4 (5): Unexpected character
+FAILED: DateTime::__construct(): Failed to parse time string (-10.5) at position 4 (5): Unexpected character
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+FAILED: DateTime::__construct() expects parameter 1 to be string, array given
+FAILED: DateTime::__construct() expects parameter 1 to be string, array given
+
+-- int indexed array --
+FAILED: DateTime::__construct() expects parameter 1 to be string, array given
+FAILED: DateTime::__construct() expects parameter 1 to be string, array given
+
+-- associative array --
+FAILED: DateTime::__construct() expects parameter 1 to be string, array given
+FAILED: DateTime::__construct() expects parameter 1 to be string, array given
+
+-- nested arrays --
+FAILED: DateTime::__construct() expects parameter 1 to be string, array given
+FAILED: DateTime::__construct() expects parameter 1 to be string, array given
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character
+FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character
+FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string SQ --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- string DQ --
+FAILED: DateTime::__construct(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database
+FAILED: DateTime::__construct(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database
+
+-- string SQ --
+FAILED: DateTime::__construct(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database
+FAILED: DateTime::__construct(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database
+
+-- mixed case string --
+FAILED: DateTime::__construct(): Failed to parse time string (sTrInG) at position 0 (s): The timezone could not be found in the database
+FAILED: DateTime::__construct(): Failed to parse time string (sTrInG) at position 0 (s): The timezone could not be found in the database
+
+-- heredoc --
+FAILED: DateTime::__construct(): Failed to parse time string (hello world) at position 0 (h): The timezone could not be found in the database
+FAILED: DateTime::__construct(): Failed to parse time string (hello world) at position 0 (h): The timezone could not be found in the database
+
+-- instance of classWithToString --
+FAILED: DateTime::__construct(): Failed to parse time string (Class A object) at position 0 (C): The timezone could not be found in the database
+FAILED: DateTime::__construct(): Failed to parse time string (Class A object) at position 0 (C): The timezone could not be found in the database
+
+-- instance of classWithoutToString --
+FAILED: DateTime::__construct() expects parameter 1 to be string, object given
+FAILED: DateTime::__construct() expects parameter 1 to be string, object given
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+FAILED: DateTime::__construct() expects parameter 1 to be string, resource given
+FAILED: DateTime::__construct() expects parameter 1 to be string, resource given
+===DONE===
diff --git a/ext/date/tests/DateTime_construct_variation2.phpt b/ext/date/tests/DateTime_construct_variation2.phpt
new file mode 100644
index 0000000..b1d80f9
--- /dev/null
+++ b/ext/date/tests/DateTime_construct_variation2.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test new DateTime() function : usage variation - Passing unexpected values to second argument $timezone.
+--FILE--
+<?php
+/* Prototype : DateTime::__construct ([ string $time="now" [, DateTimeZone $timezone=NULL ]] )
+ * Description: Returns new DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_create
+ */
+
+echo "*** Testing new DateTime() : usage variation - unexpected values to second argument \$timezone***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$time = "2005-07-14 22:30:41";
+
+foreach($inputs as $variation =>$timezone) {
+ echo "\n-- $variation --\n";
+
+ try {
+ var_dump( new DateTime($time, $timezone) );
+ } catch(Exception $e) {
+ $msg = $e->getMessage();
+ echo "FAILED: " . $msg . "\n";
+ }
+
+};
+
+// closing the resource
+fclose( $file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing new DateTime() : usage variation - unexpected values to second argument $timezone***
+
+-- int 0 --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, integer given
+
+-- int 1 --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, integer given
+
+-- int 12345 --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, integer given
+
+-- int -12345 --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, integer given
+
+-- float 10.5 --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, double given
+
+-- float -10.5 --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, double given
+
+-- float .5 --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, double given
+
+-- empty array --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given
+
+-- int indexed array --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given
+
+-- associative array --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given
+
+-- nested arrays --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, boolean given
+
+-- lowercase false --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, boolean given
+
+-- uppercase TRUE --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, boolean given
+
+-- uppercase FALSE --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, boolean given
+
+-- empty string DQ --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given
+
+-- empty string SQ --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given
+
+-- string DQ --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given
+
+-- string SQ --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given
+
+-- mixed case string --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given
+
+-- heredoc --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given
+
+-- instance of classWithToString --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, object given
+
+-- instance of classWithoutToString --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, object given
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, resource given
+===DONE===
+
diff --git a/ext/date/tests/DateTime_data-absolute.inc b/ext/date/tests/DateTime_data-absolute.inc
new file mode 100644
index 0000000..fa3acb8
--- /dev/null
+++ b/ext/date/tests/DateTime_data-absolute.inc
@@ -0,0 +1,24 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Absolute
+ */
+echo "test_absolute_7: ";
+examine_diff('2009-01-14', '2009-01-07', 'P+0Y0M7DT0H0M0S', 7, true);
+
+echo "test_absolute_negative_7: ";
+examine_diff('2009-01-07', '2009-01-14', 'P+0Y0M7DT0H0M0S', 7, true);
+
+//14 - 7 = 7
+//7 + 7 = 14
+//
+//7 - 14 = -7
+//14 - 7 = 7
diff --git a/ext/date/tests/DateTime_data-dates.inc b/ext/date/tests/DateTime_data-dates.inc
new file mode 100644
index 0000000..c6f04e1
--- /dev/null
+++ b/ext/date/tests/DateTime_data-dates.inc
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Particular days
+ */
+echo "test__7: ";
+examine_diff('2009-01-14', '2009-01-07', 'P+0Y0M7DT0H0M0S', 7);
+
+echo "test_years_positive__7_by_0_day: ";
+examine_diff('2007-02-07', '2000-02-07', 'P+7Y0M0DT0H0M0S', 2557);
+
+echo "test_years_positive__7_by_1_day: ";
+examine_diff('2007-02-08', '2000-02-07', 'P+7Y0M1DT0H0M0S', 2558);
+
+// NOTE: sub() produces different answer.
+echo "test_years_positive__6_shy_1_day: ";
+examine_diff('2007-02-06', '2000-02-07', 'P+6Y11M30DT0H0M0S', 2556);
+
+echo "test_years_positive__7_by_1_month: ";
+examine_diff('2007-03-07', '2000-02-07', 'P+7Y1M0DT0H0M0S', 2585);
+
+echo "test_years_positive__6_shy_1_month: ";
+examine_diff('2007-01-07', '2000-02-07', 'P+6Y11M0DT0H0M0S', 2526);
+
+echo "test_years_positive__7_by_1_month_split_newyear: ";
+examine_diff('2007-01-07', '1999-12-07', 'P+7Y1M0DT0H0M0S', 2588);
+
+echo "test_years_positive__6_shy_1_month_split_newyear: ";
+examine_diff('2006-12-07', '2000-01-07', 'P+6Y11M0DT0H0M0S', 2526);
+
+
+/*
+ * Particular days, negative
+ */
+echo "test_negative__7: ";
+examine_diff('2009-01-07', '2009-01-14', 'P-0Y0M7DT0H0M0S', 7);
+
+echo "test_years_negative__7_by_0_day: ";
+examine_diff('2000-02-07', '2007-02-07', 'P-7Y0M0DT0H0M0S', 2557);
+
+echo "test_years_negative__7_by_1_day: ";
+examine_diff('2000-02-07', '2007-02-08', 'P-7Y0M1DT0H0M0S', 2558);
+
+// NOTE: sub() produces different answer.
+echo "test_years_negative__6_shy_1_day: ";
+examine_diff('2000-02-07', '2007-02-06', 'P-6Y11M28DT0H0M0S', 2556);
+
+echo "test_years_negative__7_by_1_month: ";
+examine_diff('2000-02-07', '2007-03-07', 'P-7Y1M0DT0H0M0S', 2585);
+
+echo "test_years_negative__6_shy_1_month: ";
+examine_diff('2000-02-07', '2007-01-07', 'P-6Y11M0DT0H0M0S', 2526);
+
+echo "test_years_negative__7_by_1_month_split_newyear: ";
+examine_diff('1999-12-07', '2007-01-07', 'P-7Y1M0DT0H0M0S', 2588);
+
+echo "test_years_negative__6_shy_1_month_split_newyear: ";
+examine_diff('2000-01-07', '2006-12-07', 'P-6Y11M0DT0H0M0S', 2526);
diff --git a/ext/date/tests/DateTime_data-fall-type2-type2.inc b/ext/date/tests/DateTime_data-fall-type2-type2.inc
new file mode 100644
index 0000000..c45c059
--- /dev/null
+++ b/ext/date/tests/DateTime_data-fall-type2-type2.inc
@@ -0,0 +1,211 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Time, Fall, Zone Type 2 to Zone Type 2
+ *
+ * + prev: the day before the transition day 2010-11-06 18:38:28 EDT
+ * + dt: daylight time on transition day 2010-11-07 00:10:20 EDT
+ * + redodt: daylight time in the redo period 2010-11-07 01:12:33 EDT
+ * + redost: standard time in the redo period 2010-11-07 01:14:44 EST
+ * + st: standard time on the transition day 2010-11-07 03:16:55 EST
+ * + post: the day after the transition day 2010-11-08 19:59:59 EST
+ * + dtsec: daylight time 1 sec before change 2010-11-07 01:59:59 EDT
+ * + stsec: standard time first second 2010-11-07 01:00:00 EST
+ */
+echo "test_time_fall_type2_prev_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-10-04 02:18:48 EDT'); // sp prev, zt2
+examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 33);
+
+echo "test_time_fall_type2_prev_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
+
+echo "test_time_fall_type2_prev_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT6H34M5S', 0);
+
+echo "test_time_fall_type2_prev_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT7H36M16S', 0);
+
+echo "test_time_fall_type2_prev_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT9H38M27S', 0);
+
+echo "test_time_fall_type2_prev_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
+
+echo "test_time_fall_type2_dt_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
+
+echo "test_time_fall_type2_dt_type2_dt: ";
+$end = new DateTime('2010-11-07 00:15:35 EDT'); // sp dt, zt2
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
+
+echo "test_time_fall_type2_dt_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT1H2M13S', 0);
+
+echo "test_time_fall_type2_dt_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H4M24S', 0);
+
+echo "test_time_fall_type2_dt_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT4H6M35S', 0);
+
+echo "test_time_fall_type2_dt_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M1DT20H49M39S', 1);
+
+echo "test_time_fall_type2_redodt_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT6H34M5S', 0);
+
+echo "test_time_fall_type2_redodt_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT1H2M13S', 0);
+
+echo "test_time_fall_type2_redodt_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:15:35 EDT'); // sp redodt, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H3M2S', 0);
+
+echo "test_time_fall_type2_redodt_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT1H2M11S', 0);
+
+echo "test_time_fall_type2_redodt_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT3H4M22S', 0);
+
+echo "test_time_fall_type2_redodt_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P+0Y0M1DT19H47M26S', 1);
+
+echo "test_time_fall_type2_redost_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P-0Y0M0DT7H36M16S', 0);
+
+echo "test_time_fall_type2_redost_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P-0Y0M0DT2H4M24S', 0);
+
+echo "test_time_fall_type2_redost_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P-0Y0M0DT1H2M11S', 0);
+
+echo "test_time_fall_type2_redost_type2_redost: ";
+$end = new DateTime('2010-11-07 01:16:54 EST'); // sp redodt, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H2M10S', 0);
+
+echo "test_time_fall_type2_redost_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H2M11S', 0);
+
+echo "test_time_fall_type2_redost_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P+0Y0M1DT18H45M15S', 1);
+
+echo "test_time_fall_type2_st_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT9H38M27S', 0);
+
+echo "test_time_fall_type2_st_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT4H6M35S', 0);
+
+echo "test_time_fall_type2_st_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT3H4M22S', 0);
+
+echo "test_time_fall_type2_st_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT2H2M11S', 0);
+
+echo "test_time_fall_type2_st_type2_st: ";
+$end = new DateTime('2010-11-07 05:19:56 EST'); // sp st, zt2
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
+
+echo "test_time_fall_type2_st_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
+
+echo "test_time_fall_type2_post_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
+
+echo "test_time_fall_type2_post_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT20H49M39S', 1);
+
+echo "test_time_fall_type2_post_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT19H47M26S', 1);
+
+echo "test_time_fall_type2_post_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT18H45M15S', 1);
+
+echo "test_time_fall_type2_post_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
+
+echo "test_time_fall_type2_post_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-08 18:57:55 EST'); // sp post, zt2
+examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
+
+echo "test_time_fall_type2_dtsec_type2_stsec: ";
+$end = new DateTime('2010-11-07 01:00:00 EST'); // stsec, zt2
+$start = new DateTime('2010-11-07 01:59:59 EDT'); // dtsec, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
+
+echo "test_time_fall_type2_stsec_type2_dtsec: ";
+$end = new DateTime('2010-11-07 01:59:59 EDT'); // dtsec, zt2
+$start = new DateTime('2010-11-07 01:00:00 EST'); // stsec, zt2
+examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
diff --git a/ext/date/tests/DateTime_data-fall-type2-type3.inc b/ext/date/tests/DateTime_data-fall-type2-type3.inc
new file mode 100644
index 0000000..a62a8b2
--- /dev/null
+++ b/ext/date/tests/DateTime_data-fall-type2-type3.inc
@@ -0,0 +1,225 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Time, Fall, Zone Type 2 to Zone Type 3
+ *
+ * + prev: the day before the transition day 2010-11-06 18:38:28 EDT
+ * + dt: daylight time on transition day 2010-11-07 00:10:20 EDT
+ * + redodt: daylight time in the redo period 2010-11-07 01:12:33 EDT
+ * + redost: standard time in the redo period 2010-11-07 01:14:44 EST
+ * + st: standard time on the transition day 2010-11-07 03:16:55 EST
+ * + post: the day after the transition day 2010-11-08 19:59:59 EST
+ * + dtsec: daylight time 1 sec before change 2010-11-07 01:59:59 EDT
+ * + stsec: standard time first second 2010-11-07 01:00:00 EST
+ */
+echo "test_time_fall_type2_prev_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-10-04 02:18:48 EDT'); // sp prev, zt2
+examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 33);
+
+echo "test_time_fall_type2_prev_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
+
+echo "test_time_fall_type2_prev_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT6H34M5S', 0);
+
+echo "test_time_fall_type2_prev_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT7H36M16S', 0);
+
+echo "test_time_fall_type2_prev_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT9H38M27S', 0);
+
+echo "test_time_fall_type2_prev_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
+
+echo "test_time_fall_type2_dt_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
+
+echo "test_time_fall_type2_dt_type3_dt: ";
+$end = new DateTime('2010-11-07 00:15:35'); // sp dt, zt3
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
+
+echo "test_time_fall_type2_dt_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT1H2M13S', 0);
+
+echo "test_time_fall_type2_dt_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H4M24S', 0);
+
+echo "test_time_fall_type2_dt_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT4H6M35S', 0);
+
+echo "test_time_fall_type2_dt_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M1DT20H49M39S', 1);
+
+echo "test_time_fall_type2_redodt_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT6H34M5S', 0);
+
+echo "test_time_fall_type2_redodt_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT1H2M13S', 0);
+
+echo "test_time_fall_type2_redodt_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:15:35 EDT'); // sp redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H3M2S', 0);
+
+echo "test_time_fall_type2_redodt_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT1H2M11S', 0);
+
+echo "test_time_fall_type2_redodt_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT3H4M22S', 0);
+
+echo "test_time_fall_type2_redodt_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+examine_diff($end, $start, 'P+0Y0M1DT19H47M26S', 1);
+
+echo "test_time_fall_type2_redost_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P-0Y0M0DT7H36M16S', 0);
+
+echo "test_time_fall_type2_redost_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P-0Y0M0DT2H4M24S', 0);
+
+echo "test_time_fall_type2_redost_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P-0Y0M0DT1H2M11S', 0);
+
+echo "test_time_fall_type2_redost_type3_redost: ";
+$end = new DateTime('2010-11-07 01:16:54 EST'); // sp redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H2M10S', 0);
+
+echo "test_time_fall_type2_redost_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H2M11S', 0);
+
+echo "test_time_fall_type2_redost_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+examine_diff($end, $start, 'P+0Y0M1DT18H45M15S', 1);
+
+echo "test_time_fall_type2_st_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT9H38M27S', 0);
+
+echo "test_time_fall_type2_st_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT4H6M35S', 0);
+
+echo "test_time_fall_type2_st_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT3H4M22S', 0);
+
+echo "test_time_fall_type2_st_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT2H2M11S', 0);
+
+echo "test_time_fall_type2_st_type3_st: ";
+$end = new DateTime('2010-11-07 05:19:56'); // sp st, zt3
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
+
+echo "test_time_fall_type2_st_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
+
+echo "test_time_fall_type2_post_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
+
+echo "test_time_fall_type2_post_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT20H49M39S', 1);
+
+echo "test_time_fall_type2_post_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT19H47M26S', 1);
+
+echo "test_time_fall_type2_post_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT18H45M15S', 1);
+
+echo "test_time_fall_type2_post_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
+
+echo "test_time_fall_type2_post_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-08 18:57:55 EST'); // sp post, zt2
+examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
+
+echo "test_time_fall_type2_dtsec_type3_stsec: ";
+$end = new DateTime('2010-11-07 01:00:00 EST'); // stsec, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:59:59 EDT'); // dtsec, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
+
+echo "test_time_fall_type2_stsec_type3_dtsec: ";
+$end = new DateTime('2010-11-07 01:59:59 EDT'); // dtsec, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:00:00 EST'); // stsec, zt2
+examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
diff --git a/ext/date/tests/DateTime_data-fall-type3-type2.inc b/ext/date/tests/DateTime_data-fall-type3-type2.inc
new file mode 100644
index 0000000..51ef5ff
--- /dev/null
+++ b/ext/date/tests/DateTime_data-fall-type3-type2.inc
@@ -0,0 +1,227 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Time, Fall, Zone Type 3 to Zone Type 2
+ *
+ * + prev: the day before the transition day 2010-11-06 18:38:28 EDT
+ * + dt: daylight time on transition day 2010-11-07 00:10:20 EDT
+ * + redodt: daylight time in the redo period 2010-11-07 01:12:33 EDT
+ * + redost: standard time in the redo period 2010-11-07 01:14:44 EST
+ * + st: standard time on the transition day 2010-11-07 03:16:55 EST
+ * + post: the day after the transition day 2010-11-08 19:59:59 EST
+ * + dtsec: daylight time 1 sec before change 2010-11-07 01:59:59 EDT
+ * + stsec: standard time first second 2010-11-07 01:00:00 EST
+ */
+echo "test_time_fall_type3_prev_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-10-04 02:18:48'); // sp prev, zt3
+examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 33);
+
+echo "test_time_fall_type3_prev_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
+
+echo "test_time_fall_type3_prev_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT6H34M5S', 0);
+
+echo "test_time_fall_type3_prev_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT7H36M16S', 0);
+
+echo "test_time_fall_type3_prev_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT9H38M27S', 0);
+
+echo "test_time_fall_type3_prev_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
+
+echo "test_time_fall_type3_dt_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
+
+echo "test_time_fall_type3_dt_type2_dt: ";
+$end = new DateTime('2010-11-07 00:15:35 EDT'); // sp dt, zt2
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
+
+echo "test_time_fall_type3_dt_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT1H2M13S', 0);
+
+echo "test_time_fall_type3_dt_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H4M24S', 0);
+
+echo "test_time_fall_type3_dt_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT4H6M35S', 0);
+
+echo "test_time_fall_type3_dt_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M1DT20H49M39S', 1);
+
+echo "test_time_fall_type3_redodt_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT6H34M5S', 0);
+
+echo "test_time_fall_type3_redodt_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT1H2M13S', 0);
+
+echo "test_time_fall_type3_redodt_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:15:35 EDT'); // sp redodt, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H3M2S', 0);
+
+echo "test_time_fall_type3_redodt_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT1H2M11S', 0);
+
+echo "test_time_fall_type3_redodt_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT3H4M22S', 0);
+
+echo "test_time_fall_type3_redodt_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M1DT19H47M26S', 1);
+
+echo "test_time_fall_type3_redost_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT7H36M16S', 0);
+
+echo "test_time_fall_type3_redost_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT2H4M24S', 0);
+
+echo "test_time_fall_type3_redost_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT1H2M11S', 0);
+
+echo "test_time_fall_type3_redost_type2_redost: ";
+$end = new DateTime('2010-11-07 01:16:54 EST'); // sp redodt, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H2M10S', 0);
+
+echo "test_time_fall_type3_redost_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H2M11S', 0);
+
+echo "test_time_fall_type3_redost_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M1DT18H45M15S', 1);
+
+echo "test_time_fall_type3_st_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT9H38M27S', 0);
+
+echo "test_time_fall_type3_st_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT4H6M35S', 0);
+
+echo "test_time_fall_type3_st_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT3H4M22S', 0);
+
+echo "test_time_fall_type3_st_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT2H2M11S', 0);
+
+echo "test_time_fall_type3_st_type2_st: ";
+$end = new DateTime('2010-11-07 05:19:56 EST'); // sp st, zt2
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
+
+echo "test_time_fall_type3_st_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
+
+echo "test_time_fall_type3_post_type2_prev: ";
+$end = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
+
+echo "test_time_fall_type3_post_type2_dt: ";
+$end = new DateTime('2010-11-07 00:10:20 EDT'); // dt, zt2
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT20H49M39S', 1);
+
+echo "test_time_fall_type3_post_type2_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT19H47M26S', 1);
+
+echo "test_time_fall_type3_post_type2_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT18H45M15S', 1);
+
+echo "test_time_fall_type3_post_type2_st: ";
+$end = new DateTime('2010-11-07 03:16:55 EST'); // st, zt2
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
+
+echo "test_time_fall_type3_post_type2_post: ";
+$end = new DateTime('2010-11-08 19:59:59 EST'); // post, zt2
+$start = new DateTime('2010-11-08 18:57:55'); // sp post, zt3
+examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
+
+echo "test_time_fall_type3_dtsec_type2_stsec: ";
+$end = new DateTime('2010-11-07 01:00:00 EST'); // stsec, zt2
+$start = new DateTime('2010-11-07 01:59:59 EDT'); // dtsec, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
+
+echo "test_time_fall_type3_stsec_type2_dtsec: ";
+$end = new DateTime('2010-11-07 01:59:59 EDT'); // dtsec, zt2
+$start = new DateTime('2010-11-07 01:00:00 EST'); // stsec, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
diff --git a/ext/date/tests/DateTime_data-fall-type3-type3.inc b/ext/date/tests/DateTime_data-fall-type3-type3.inc
new file mode 100644
index 0000000..48c1c33
--- /dev/null
+++ b/ext/date/tests/DateTime_data-fall-type3-type3.inc
@@ -0,0 +1,239 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Time, Fall, Zone Type 3 to Zone Type 3
+ *
+ * + prev: the day before the transition day 2010-11-06 18:38:28
+ * + dt: daylight time on transition day 2010-11-07 00:10:20
+ * + redodt: daylight time in the redo period 2010-11-07 01:12:33 EDT, + TZ
+ * + redost: standard time in the redo period 2010-11-07 01:14:44 EST, + TZ
+ * + st: standard time on the transition day 2010-11-07 03:16:55
+ * + post: the day after the transition day 2010-11-08 19:59:59
+ * + dtsec: daylight time 1 sec before change 2010-11-07 01:59:59 EDT, + TZ
+ * + stsec: standard time first second 2010-11-07 01:00:00 EST, + TZ
+ */
+echo "test_time_fall_type3_prev_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-10-04 02:18:48'); // sp prev, zt3
+examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 33);
+
+echo "test_time_fall_type3_prev_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
+
+echo "test_time_fall_type3_prev_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT6H34M5S', 0);
+
+echo "test_time_fall_type3_prev_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT7H36M16S', 0);
+
+echo "test_time_fall_type3_prev_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT9H38M27S', 0);
+
+echo "test_time_fall_type3_prev_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
+
+echo "test_time_fall_type3_dt_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
+
+echo "test_time_fall_type3_dt_type3_dt: ";
+$end = new DateTime('2010-11-07 00:15:35'); // sp dt, zt3
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
+
+echo "test_time_fall_type3_dt_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT1H2M13S', 0);
+
+echo "test_time_fall_type3_dt_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H4M24S', 0);
+
+echo "test_time_fall_type3_dt_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT4H6M35S', 0);
+
+echo "test_time_fall_type3_dt_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M1DT20H49M39S', 1);
+
+echo "test_time_fall_type3_redodt_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT6H34M5S', 0);
+
+echo "test_time_fall_type3_redodt_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT1H2M13S', 0);
+
+echo "test_time_fall_type3_redodt_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:15:35 EDT'); // sp redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H3M2S', 0);
+
+echo "test_time_fall_type3_redodt_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT1H2M11S', 0);
+
+echo "test_time_fall_type3_redodt_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT3H4M22S', 0);
+
+echo "test_time_fall_type3_redodt_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M1DT19H47M26S', 1);
+
+echo "test_time_fall_type3_redost_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT7H36M16S', 0);
+
+echo "test_time_fall_type3_redost_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT2H4M24S', 0);
+
+echo "test_time_fall_type3_redost_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT1H2M11S', 0);
+
+echo "test_time_fall_type3_redost_type3_redost: ";
+$end = new DateTime('2010-11-07 01:16:54 EST'); // sp redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H2M10S', 0);
+
+echo "test_time_fall_type3_redost_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H2M11S', 0);
+
+echo "test_time_fall_type3_redost_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M1DT18H45M15S', 1);
+
+echo "test_time_fall_type3_st_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT9H38M27S', 0);
+
+echo "test_time_fall_type3_st_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT4H6M35S', 0);
+
+echo "test_time_fall_type3_st_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT3H4M22S', 0);
+
+echo "test_time_fall_type3_st_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT2H2M11S', 0);
+
+echo "test_time_fall_type3_st_type3_st: ";
+$end = new DateTime('2010-11-07 05:19:56'); // sp st, zt3
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
+
+echo "test_time_fall_type3_st_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-07 03:16:55'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
+
+echo "test_time_fall_type3_post_type3_prev: ";
+$end = new DateTime('2010-11-06 18:38:28'); // prev, zt3
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
+
+echo "test_time_fall_type3_post_type3_dt: ";
+$end = new DateTime('2010-11-07 00:10:20'); // dt, zt3
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT20H49M39S', 1);
+
+echo "test_time_fall_type3_post_type3_redodt: ";
+$end = new DateTime('2010-11-07 01:12:33 EDT'); // redodt, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT19H47M26S', 1);
+
+echo "test_time_fall_type3_post_type3_redost: ";
+$end = new DateTime('2010-11-07 01:14:44 EST'); // redost, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT18H45M15S', 1);
+
+echo "test_time_fall_type3_post_type3_st: ";
+$end = new DateTime('2010-11-07 03:16:55'); // st, zt3
+$start = new DateTime('2010-11-08 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
+
+echo "test_time_fall_type3_post_type3_post: ";
+$end = new DateTime('2010-11-08 19:59:59'); // post, zt3
+$start = new DateTime('2010-11-08 18:57:55'); // sp post, zt3
+examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
+
+echo "test_time_fall_type3_dtsec_type3_stsec: ";
+$end = new DateTime('2010-11-07 01:00:00 EST'); // stsec, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:59:59 EDT'); // dtsec, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
+
+echo "test_time_fall_type3_stsec_type3_dtsec: ";
+$end = new DateTime('2010-11-07 01:59:59 EDT'); // dtsec, zt2
+$end->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+$start = new DateTime('2010-11-07 01:00:00 EST'); // stsec, zt2
+$start->setTimezone(new DateTimeZone('America/New_York')); // zt2 -> zt3
+examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
diff --git a/ext/date/tests/DateTime_data-february.inc b/ext/date/tests/DateTime_data-february.inc
new file mode 100644
index 0000000..cc9d85d
--- /dev/null
+++ b/ext/date/tests/DateTime_data-february.inc
@@ -0,0 +1,217 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Check PHP bug 49081
+ */
+echo "test_bug_49081__1: ";
+examine_diff('2010-03-31', '2010-03-01', 'P+0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081__2: ";
+examine_diff('2010-04-01', '2010-03-01', 'P+0Y1M0DT0H0M0S', 31);
+
+echo "test_bug_49081__3: ";
+examine_diff('2010-04-01', '2010-03-31', 'P+0Y0M1DT0H0M0S', 1);
+
+echo "test_bug_49081__4: ";
+examine_diff('2010-04-29', '2010-03-31', 'P+0Y0M29DT0H0M0S', 29);
+
+echo "test_bug_49081__5: ";
+examine_diff('2010-04-30', '2010-03-31', 'P+0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081__6: ";
+examine_diff('2010-04-30', '2010-03-30', 'P+0Y1M0DT0H0M0S', 31);
+
+echo "test_bug_49081__7: ";
+examine_diff('2010-04-30', '2010-03-29', 'P+0Y1M1DT0H0M0S', 32);
+
+echo "test_bug_49081__8: ";
+examine_diff('2010-01-29', '2010-01-01', 'P+0Y0M28DT0H0M0S', 28);
+
+echo "test_bug_49081__9: ";
+examine_diff('2010-01-30', '2010-01-01', 'P+0Y0M29DT0H0M0S', 29);
+
+echo "test_bug_49081__10: ";
+examine_diff('2010-01-31', '2010-01-01', 'P+0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081__11: ";
+examine_diff('2010-02-01', '2010-01-01', 'P+0Y1M0DT0H0M0S', 31);
+
+echo "test_bug_49081__12: ";
+examine_diff('2010-02-01', '2010-01-31', 'P+0Y0M1DT0H0M0S', 1);
+
+echo "test_bug_49081__13: ";
+examine_diff('2010-02-27', '2010-01-31', 'P+0Y0M27DT0H0M0S', 27);
+
+echo "test_bug_49081__14: ";
+examine_diff('2010-02-28', '2010-01-31', 'P+0Y0M28DT0H0M0S', 28);
+
+echo "test_bug_49081__15: ";
+examine_diff('2010-02-28', '2010-01-30', 'P+0Y0M29DT0H0M0S', 29);
+
+echo "test_bug_49081__16: ";
+examine_diff('2010-02-28', '2010-01-29', 'P+0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081__17: ";
+examine_diff('2010-02-28', '2010-01-28', 'P+0Y1M0DT0H0M0S', 31);
+
+echo "test_bug_49081__18: ";
+examine_diff('2010-02-28', '2010-01-27', 'P+0Y1M1DT0H0M0S', 32);
+
+echo "test_bug_49081__19: ";
+examine_diff('2010-03-01', '2010-01-01', 'P+0Y2M0DT0H0M0S', 59);
+
+echo "test_bug_49081__20: ";
+examine_diff('2010-03-01', '2010-01-31', 'P+0Y0M29DT0H0M0S', 29);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081__21: ";
+examine_diff('2010-03-27', '2010-01-31', 'P+0Y1M24DT0H0M0S', 55);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081__22: ";
+examine_diff('2010-03-28', '2010-01-31', 'P+0Y1M25DT0H0M0S', 56);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081__23: ";
+examine_diff('2010-03-29', '2010-01-31', 'P+0Y1M26DT0H0M0S', 57);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081__24: ";
+examine_diff('2010-03-30', '2010-01-31', 'P+0Y1M27DT0H0M0S', 58);
+
+echo "test_bug_49081__25: ";
+examine_diff('2010-03-31', '2010-01-31', 'P+0Y2M0DT0H0M0S', 59);
+
+echo "test_bug_49081__26: ";
+examine_diff('2010-03-31', '2010-01-30', 'P+0Y2M1DT0H0M0S', 60);
+
+echo "test_bug_49081__27: ";
+examine_diff('2009-01-31', '2009-01-01', 'P+0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081__28: ";
+examine_diff('2010-03-27', '2010-02-28', 'P+0Y0M27DT0H0M0S', 27);
+
+echo "test_bug_49081__29: ";
+examine_diff('2010-03-28', '2010-02-28', 'P+0Y1M0DT0H0M0S', 28);
+
+echo "test_bug_49081__30: ";
+examine_diff('2010-03-29', '2010-02-28', 'P+0Y1M1DT0H0M0S', 29);
+
+echo "test_bug_49081__31: ";
+examine_diff('2010-03-27', '2010-02-27', 'P+0Y1M0DT0H0M0S', 28);
+
+echo "test_bug_49081__32: ";
+examine_diff('2010-03-27', '2010-02-26', 'P+0Y1M1DT0H0M0S', 29);
+
+
+/*
+ * Check PHP bug 49081, negative
+ */
+echo "test_bug_49081_negative__1: ";
+examine_diff('2010-03-01', '2010-03-31', 'P-0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081_negative__2: ";
+examine_diff('2010-03-01', '2010-04-01', 'P-0Y1M0DT0H0M0S', 31);
+
+echo "test_bug_49081_negative__3: ";
+examine_diff('2010-03-31', '2010-04-01', 'P-0Y0M1DT0H0M0S', 1);
+
+echo "test_bug_49081_negative__4: ";
+examine_diff('2010-03-31', '2010-04-29', 'P-0Y0M29DT0H0M0S', 29);
+
+echo "test_bug_49081_negative__5: ";
+examine_diff('2010-03-31', '2010-04-30', 'P-0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081_negative__6: ";
+examine_diff('2010-03-30', '2010-04-30', 'P-0Y1M0DT0H0M0S', 31);
+
+echo "test_bug_49081_negative__7: ";
+examine_diff('2010-03-29', '2010-04-30', 'P-0Y1M1DT0H0M0S', 32);
+
+echo "test_bug_49081_negative__8: ";
+examine_diff('2010-01-01', '2010-01-29', 'P-0Y0M28DT0H0M0S', 28);
+
+echo "test_bug_49081_negative__9: ";
+examine_diff('2010-01-01', '2010-01-30', 'P-0Y0M29DT0H0M0S', 29);
+
+echo "test_bug_49081_negative__10: ";
+examine_diff('2010-01-01', '2010-01-31', 'P-0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081_negative__11: ";
+examine_diff('2010-01-01', '2010-02-01', 'P-0Y1M0DT0H0M0S', 31);
+
+echo "test_bug_49081_negative__12: ";
+examine_diff('2010-01-31', '2010-02-01', 'P-0Y0M1DT0H0M0S', 1);
+
+echo "test_bug_49081_negative__13: ";
+examine_diff('2010-01-31', '2010-02-27', 'P-0Y0M27DT0H0M0S', 27);
+
+echo "test_bug_49081_negative__14: ";
+examine_diff('2010-01-31', '2010-02-28', 'P-0Y0M28DT0H0M0S', 28);
+
+echo "test_bug_49081_negative__15: ";
+examine_diff('2010-01-30', '2010-02-28', 'P-0Y0M29DT0H0M0S', 29);
+
+echo "test_bug_49081_negative__16: ";
+examine_diff('2010-01-29', '2010-02-28', 'P-0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081_negative__17: ";
+examine_diff('2010-01-28', '2010-02-28', 'P-0Y1M0DT0H0M0S', 31);
+
+echo "test_bug_49081_negative__18: ";
+examine_diff('2010-01-27', '2010-02-28', 'P-0Y1M1DT0H0M0S', 32);
+
+echo "test_bug_49081_negative__19: ";
+examine_diff('2010-01-01', '2010-03-01', 'P-0Y2M0DT0H0M0S', 59);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081_negative__20: ";
+examine_diff('2010-01-31', '2010-03-01', 'P-0Y1M1DT0H0M0S', 29);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081_negative__21: ";
+examine_diff('2010-01-31', '2010-03-27', 'P-0Y1M27DT0H0M0S', 55);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081_negative__22: ";
+examine_diff('2010-01-31', '2010-03-28', 'P-0Y1M28DT0H0M0S', 56);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081_negative__23: ";
+examine_diff('2010-01-31', '2010-03-29', 'P-0Y1M29DT0H0M0S', 57);
+
+// NOTE: sub() produces different answer.
+echo "test_bug_49081_negative__24: ";
+examine_diff('2010-01-31', '2010-03-30', 'P-0Y1M30DT0H0M0S', 58);
+
+echo "test_bug_49081_negative__25: ";
+examine_diff('2010-01-31', '2010-03-31', 'P-0Y2M0DT0H0M0S', 59);
+
+echo "test_bug_49081_negative__26: ";
+examine_diff('2010-01-30', '2010-03-31', 'P-0Y2M1DT0H0M0S', 60);
+
+echo "test_bug_49081_negative__27: ";
+examine_diff('2009-01-01', '2009-01-31', 'P-0Y0M30DT0H0M0S', 30);
+
+echo "test_bug_49081_negative__28: ";
+examine_diff('2010-02-28', '2010-03-27', 'P-0Y0M27DT0H0M0S', 27);
+
+echo "test_bug_49081_negative__29: ";
+examine_diff('2010-02-28', '2010-03-28', 'P-0Y1M0DT0H0M0S', 28);
+
+echo "test_bug_49081_negative__30: ";
+examine_diff('2010-02-28', '2010-03-29', 'P-0Y1M1DT0H0M0S', 29);
+
+echo "test_bug_49081_negative__31: ";
+examine_diff('2010-02-27', '2010-03-27', 'P-0Y1M0DT0H0M0S', 28);
+
+echo "test_bug_49081_negative__32: ";
+examine_diff('2010-02-26', '2010-03-27', 'P-0Y1M1DT0H0M0S', 29);
diff --git a/ext/date/tests/DateTime_data-massive.inc b/ext/date/tests/DateTime_data-massive.inc
new file mode 100644
index 0000000..bf20759
--- /dev/null
+++ b/ext/date/tests/DateTime_data-massive.inc
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Massive dates
+ */
+echo "test_massive_positive: ";
+$end = new DateTime;
+$end->setDate(333333, 1, 1);
+$end->setTime(16, 18, 02);
+
+$start = new DateTime;
+$start->setDate(-333333, 1, 1);
+$start->setTime(16, 18, 02);
+
+examine_diff($end, $start, 'P+666666Y0M0DT0H0M0S', 243494757);
+
+echo "test_massive_negative: ";
+$end = new DateTime;
+$end->setDate(-333333, 1, 1);
+$end->setTime(16, 18, 02);
+
+$start = new DateTime;
+$start->setDate(333333, 1, 1);
+$start->setTime(16, 18, 02);
+
+examine_diff($end, $start, 'P-666666Y0M0DT0H0M0S', 243494757);
diff --git a/ext/date/tests/DateTime_data-spring-type2-type2.inc b/ext/date/tests/DateTime_data-spring-type2-type2.inc
new file mode 100644
index 0000000..d9e07c3
--- /dev/null
+++ b/ext/date/tests/DateTime_data-spring-type2-type2.inc
@@ -0,0 +1,109 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Time, Spring, Zone Type 2 to Zone Type 2
+ *
+ * + prev: the day before the transition day 2010-03-13 18:38:28 EST
+ * + st: standard time on transition day 2010-03-14 00:10:20 EST
+ * + dt: daylight time on the transition day 2010-03-14 03:16:55 EDT
+ * + post: the day after the transition day 2010-03-15 19:59:59 EDT
+ * + stsec: standard time 1 sec before change 2010-03-14 01:59:59 EST
+ * + dtsec: daylight time first second 2010-03-14 03:00:00 EDT
+ */
+echo "test_time_spring_type2_prev_type2_prev: ";
+$end = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+$start = new DateTime('2010-02-11 02:18:48 EST'); // sp prev, zt2
+examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 30);
+
+echo "test_time_spring_type2_prev_type2_st: ";
+$end = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+$start = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
+
+echo "test_time_spring_type2_prev_type2_dt: ";
+$end = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+$start = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT7H38M27S', 0);
+
+echo "test_time_spring_type2_prev_type2_post: ";
+$end = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+$start = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
+
+echo "test_time_spring_type2_st_type2_prev: ";
+$end = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+$start = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
+
+echo "test_time_spring_type2_st_type2_st: ";
+$end = new DateTime('2010-03-14 00:15:35 EST'); // sp st, zt2
+$start = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
+
+echo "test_time_spring_type2_st_type2_dt: ";
+$end = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+$start = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H6M35S', 0);
+
+echo "test_time_spring_type2_st_type2_post: ";
+$end = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+$start = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M1DT18H49M39S', 1);
+
+echo "test_time_spring_type2_dt_type2_prev: ";
+$end = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+$start = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT7H38M27S', 0);
+
+echo "test_time_spring_type2_dt_type2_st: ";
+$end = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+$start = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT2H6M35S', 0);
+
+echo "test_time_spring_type2_dt_type2_dt: ";
+$end = new DateTime('2010-03-14 05:19:56 EDT'); // sp dt, zt2
+$start = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
+
+echo "test_time_spring_type2_dt_type2_post: ";
+$end = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+$start = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
+
+echo "test_time_spring_type2_post_type2_prev: ";
+$end = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+$start = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
+
+echo "test_time_spring_type2_post_type2_st: ";
+$end = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+$start = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT18H49M39S', 1);
+
+echo "test_time_spring_type2_post_type2_dt: ";
+$end = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+$start = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
+
+echo "test_time_spring_type2_post_type2_post: ";
+$end = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+$start = new DateTime('2010-03-15 18:57:55 EDT'); // sp post, zt2
+examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
+
+echo "test_time_spring_type2_stsec_type2_dtsec: ";
+$end = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2
+$start = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
+
+echo "test_time_spring_type2_dtsec_type2_stsec: ";
+$end = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2
+$start = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2
+examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
diff --git a/ext/date/tests/DateTime_data-spring-type2-type3.inc b/ext/date/tests/DateTime_data-spring-type2-type3.inc
new file mode 100644
index 0000000..d66fc51
--- /dev/null
+++ b/ext/date/tests/DateTime_data-spring-type2-type3.inc
@@ -0,0 +1,109 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Time, Spring, Zone Type 2 to Zone Type 3
+ *
+ * + prev: the day before the transition day 2010-03-13 18:38:28 EST
+ * + st: standard time on transition day 2010-03-14 00:10:20 EST
+ * + dt: daylight time on the transition day 2010-03-14 03:16:55 EDT
+ * + post: the day after the transition day 2010-03-15 19:59:59 EDT
+ * + stsec: standard time 1 sec before change 2010-03-14 01:59:59 EST
+ * + dtsec: daylight time first second 2010-03-14 03:00:00 EDT
+ */
+echo "test_time_spring_type2_prev_type3_prev: ";
+$end = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+$start = new DateTime('2010-02-11 02:18:48 EST'); // sp prev, zt2
+examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 30);
+
+echo "test_time_spring_type2_prev_type3_st: ";
+$end = new DateTime('2010-03-14 00:10:20'); // st, zt3
+$start = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
+
+echo "test_time_spring_type2_prev_type3_dt: ";
+$end = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+$start = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M0DT7H38M27S', 0);
+
+echo "test_time_spring_type2_prev_type3_post: ";
+$end = new DateTime('2010-03-15 19:59:59'); // post, zt3
+$start = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
+
+echo "test_time_spring_type2_st_type3_prev: ";
+$end = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+$start = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
+
+echo "test_time_spring_type2_st_type3_st: ";
+$end = new DateTime('2010-03-14 00:15:35'); // sp st, zt3
+$start = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
+
+echo "test_time_spring_type2_st_type3_dt: ";
+$end = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+$start = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H6M35S', 0);
+
+echo "test_time_spring_type2_st_type3_post: ";
+$end = new DateTime('2010-03-15 19:59:59'); // post, zt3
+$start = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+examine_diff($end, $start, 'P+0Y0M1DT18H49M39S', 1);
+
+echo "test_time_spring_type2_dt_type3_prev: ";
+$end = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+$start = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT7H38M27S', 0);
+
+echo "test_time_spring_type2_dt_type3_st: ";
+$end = new DateTime('2010-03-14 00:10:20'); // st, zt3
+$start = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+examine_diff($end, $start, 'P-0Y0M0DT2H6M35S', 0);
+
+echo "test_time_spring_type2_dt_type3_dt: ";
+$end = new DateTime('2010-03-14 05:19:56'); // sp dt, zt3
+$start = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
+
+echo "test_time_spring_type2_dt_type3_post: ";
+$end = new DateTime('2010-03-15 19:59:59'); // post, zt3
+$start = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
+
+echo "test_time_spring_type2_post_type3_prev: ";
+$end = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+$start = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
+
+echo "test_time_spring_type2_post_type3_st: ";
+$end = new DateTime('2010-03-14 00:10:20'); // st, zt3
+$start = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT18H49M39S', 1);
+
+echo "test_time_spring_type2_post_type3_dt: ";
+$end = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+$start = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
+
+echo "test_time_spring_type2_post_type3_post: ";
+$end = new DateTime('2010-03-15 19:59:59'); // post, zt3
+$start = new DateTime('2010-03-15 18:57:55 EDT'); // sp post, zt2
+examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
+
+echo "test_time_spring_type2_stsec_type3_dtsec: ";
+$end = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3
+$start = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2
+examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
+
+echo "test_time_spring_type2_dtsec_type3_stsec: ";
+$end = new DateTime('2010-03-14 01:59:59'); // stsec, zt3
+$start = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2
+examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
diff --git a/ext/date/tests/DateTime_data-spring-type3-type2.inc b/ext/date/tests/DateTime_data-spring-type3-type2.inc
new file mode 100644
index 0000000..92211f4
--- /dev/null
+++ b/ext/date/tests/DateTime_data-spring-type3-type2.inc
@@ -0,0 +1,109 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Time, Spring, Zone Type 3 to Zone Type 2
+ *
+ * + prev: the day before the transition day 2010-03-13 18:38:28 EST
+ * + st: standard time on transition day 2010-03-14 00:10:20 EST
+ * + dt: daylight time on the transition day 2010-03-14 03:16:55 EDT
+ * + post: the day after the transition day 2010-03-15 19:59:59 EDT
+ * + stsec: standard time 1 sec before change 2010-03-14 01:59:59 EST
+ * + dtsec: daylight time first second 2010-03-14 03:00:00 EDT
+ */
+echo "test_time_spring_type3_prev_type2_prev: ";
+$end = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+$start = new DateTime('2010-02-11 02:18:48'); // sp prev, zt3
+examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 30);
+
+echo "test_time_spring_type3_prev_type2_st: ";
+$end = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+$start = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
+
+echo "test_time_spring_type3_prev_type2_dt: ";
+$end = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+$start = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT7H38M27S', 0);
+
+echo "test_time_spring_type3_prev_type2_post: ";
+$end = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+$start = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
+
+echo "test_time_spring_type3_st_type2_prev: ";
+$end = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+$start = new DateTime('2010-03-14 00:10:20'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
+
+echo "test_time_spring_type3_st_type2_st: ";
+$end = new DateTime('2010-03-14 00:15:35 EST'); // sp st, zt2
+$start = new DateTime('2010-03-14 00:10:20'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
+
+echo "test_time_spring_type3_st_type2_dt: ";
+$end = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+$start = new DateTime('2010-03-14 00:10:20'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H6M35S', 0);
+
+echo "test_time_spring_type3_st_type2_post: ";
+$end = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+$start = new DateTime('2010-03-14 00:10:20'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M1DT18H49M39S', 1);
+
+echo "test_time_spring_type3_dt_type2_prev: ";
+$end = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+$start = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+examine_diff($end, $start, 'P-0Y0M0DT7H38M27S', 0);
+
+echo "test_time_spring_type3_dt_type2_st: ";
+$end = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+$start = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+examine_diff($end, $start, 'P-0Y0M0DT2H6M35S', 0);
+
+echo "test_time_spring_type3_dt_type2_dt: ";
+$end = new DateTime('2010-03-14 05:19:56 EDT'); // sp dt, zt2
+$start = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
+
+echo "test_time_spring_type3_dt_type2_post: ";
+$end = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+$start = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
+
+echo "test_time_spring_type3_post_type2_prev: ";
+$end = new DateTime('2010-03-13 18:38:28 EST'); // prev, zt2
+$start = new DateTime('2010-03-15 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
+
+echo "test_time_spring_type3_post_type2_st: ";
+$end = new DateTime('2010-03-14 00:10:20 EST'); // st, zt2
+$start = new DateTime('2010-03-15 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT18H49M39S', 1);
+
+echo "test_time_spring_type3_post_type2_dt: ";
+$end = new DateTime('2010-03-14 03:16:55 EDT'); // dt, zt2
+$start = new DateTime('2010-03-15 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
+
+echo "test_time_spring_type3_post_type2_post: ";
+$end = new DateTime('2010-03-15 19:59:59 EDT'); // post, zt2
+$start = new DateTime('2010-03-15 18:57:55'); // sp post, zt3
+examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
+
+echo "test_time_spring_type3_stsec_type2_dtsec: ";
+$end = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2
+$start = new DateTime('2010-03-14 01:59:59'); // stsec, zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
+
+echo "test_time_spring_type3_dtsec_type2_stsec: ";
+$end = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2
+$start = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3
+examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
diff --git a/ext/date/tests/DateTime_data-spring-type3-type3.inc b/ext/date/tests/DateTime_data-spring-type3-type3.inc
new file mode 100644
index 0000000..de1dee1
--- /dev/null
+++ b/ext/date/tests/DateTime_data-spring-type3-type3.inc
@@ -0,0 +1,109 @@
+<?php
+
+/*
+ * Note: test names match method names in a set of PHPUnit tests
+ * in a userland package. Please be so kind as to leave them.
+ */
+
+date_default_timezone_set('America/New_York');
+
+
+/*
+ * Time, Spring, Zone Type 3 to Zone Type 3
+ *
+ * + prev: the day before the transition day 2010-03-13 18:38:28
+ * + st: standard time on transition day 2010-03-14 00:10:20
+ * + dt: daylight time on the transition day 2010-03-14 03:16:55
+ * + post: the day after the transition day 2010-03-15 19:59:59
+ * + stsec: standard time 1 sec before change 2010-03-14 01:59:59
+ * + dtsec: daylight time first second 2010-03-14 03:00:00
+ */
+echo "test_time_spring_type3_prev_type3_prev: ";
+$end = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+$start = new DateTime('2010-02-11 02:18:48'); // sp prev, zt3
+examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 30);
+
+echo "test_time_spring_type3_prev_type3_st: ";
+$end = new DateTime('2010-03-14 00:10:20'); // st, zt3
+$start = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
+
+echo "test_time_spring_type3_prev_type3_dt: ";
+$end = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+$start = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M0DT7H38M27S', 0);
+
+echo "test_time_spring_type3_prev_type3_post: ";
+$end = new DateTime('2010-03-15 19:59:59'); // post, zt3
+$start = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
+
+echo "test_time_spring_type3_st_type3_prev: ";
+$end = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+$start = new DateTime('2010-03-14 00:10:20'); // st, zt3
+examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
+
+echo "test_time_spring_type3_st_type3_st: ";
+$end = new DateTime('2010-03-14 00:15:35'); // sp st, zt3
+$start = new DateTime('2010-03-14 00:10:20'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
+
+echo "test_time_spring_type3_st_type3_dt: ";
+$end = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+$start = new DateTime('2010-03-14 00:10:20'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H6M35S', 0);
+
+echo "test_time_spring_type3_st_type3_post: ";
+$end = new DateTime('2010-03-15 19:59:59'); // post, zt3
+$start = new DateTime('2010-03-14 00:10:20'); // st, zt3
+examine_diff($end, $start, 'P+0Y0M1DT18H49M39S', 1);
+
+echo "test_time_spring_type3_dt_type3_prev: ";
+$end = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+$start = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+examine_diff($end, $start, 'P-0Y0M0DT7H38M27S', 0);
+
+echo "test_time_spring_type3_dt_type3_st: ";
+$end = new DateTime('2010-03-14 00:10:20'); // st, zt3
+$start = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+examine_diff($end, $start, 'P-0Y0M0DT2H6M35S', 0);
+
+echo "test_time_spring_type3_dt_type3_dt: ";
+$end = new DateTime('2010-03-14 05:19:56'); // sp dt, zt3
+$start = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
+
+echo "test_time_spring_type3_dt_type3_post: ";
+$end = new DateTime('2010-03-15 19:59:59'); // post, zt3
+$start = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
+
+echo "test_time_spring_type3_post_type3_prev: ";
+$end = new DateTime('2010-03-13 18:38:28'); // prev, zt3
+$start = new DateTime('2010-03-15 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
+
+echo "test_time_spring_type3_post_type3_st: ";
+$end = new DateTime('2010-03-14 00:10:20'); // st, zt3
+$start = new DateTime('2010-03-15 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT18H49M39S', 1);
+
+echo "test_time_spring_type3_post_type3_dt: ";
+$end = new DateTime('2010-03-14 03:16:55'); // dt, zt3
+$start = new DateTime('2010-03-15 19:59:59'); // post, zt3
+examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
+
+echo "test_time_spring_type3_post_type3_post: ";
+$end = new DateTime('2010-03-15 19:59:59'); // post, zt3
+$start = new DateTime('2010-03-15 18:57:55'); // sp post, zt3
+examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
+
+echo "test_time_spring_type3_stsec_type3_dtsec: ";
+$end = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3
+$start = new DateTime('2010-03-14 01:59:59'); // stsec, zt3
+examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
+
+echo "test_time_spring_type3_dtsec_type3_stsec: ";
+$end = new DateTime('2010-03-14 01:59:59'); // stsec, zt3
+$start = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3
+examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
diff --git a/ext/date/tests/DateTime_days-absolute.phpt b/ext/date/tests/DateTime_days-absolute.phpt
new file mode 100644
index 0000000..7a150e3
--- /dev/null
+++ b/ext/date/tests/DateTime_days-absolute.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DateTime::diff() days -- absolute
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-absolute.inc';
+
+?>
+--EXPECT--
+test_absolute_7: DAYS: **7**
+test_absolute_negative_7: DAYS: **7**
diff --git a/ext/date/tests/DateTime_days-dates.phpt b/ext/date/tests/DateTime_days-dates.phpt
new file mode 100644
index 0000000..446d56d
--- /dev/null
+++ b/ext/date/tests/DateTime_days-dates.phpt
@@ -0,0 +1,29 @@
+--TEST--
+DateTime::diff() days -- dates
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-dates.inc';
+
+?>
+--EXPECT--
+test__7: DAYS: **7**
+test_years_positive__7_by_0_day: DAYS: **2557**
+test_years_positive__7_by_1_day: DAYS: **2558**
+test_years_positive__6_shy_1_day: DAYS: **2556**
+test_years_positive__7_by_1_month: DAYS: **2585**
+test_years_positive__6_shy_1_month: DAYS: **2526**
+test_years_positive__7_by_1_month_split_newyear: DAYS: **2588**
+test_years_positive__6_shy_1_month_split_newyear: DAYS: **2526**
+test_negative__7: DAYS: **7**
+test_years_negative__7_by_0_day: DAYS: **2557**
+test_years_negative__7_by_1_day: DAYS: **2558**
+test_years_negative__6_shy_1_day: DAYS: **2556**
+test_years_negative__7_by_1_month: DAYS: **2585**
+test_years_negative__6_shy_1_month: DAYS: **2526**
+test_years_negative__7_by_1_month_split_newyear: DAYS: **2588**
+test_years_negative__6_shy_1_month_split_newyear: DAYS: **2526**
diff --git a/ext/date/tests/DateTime_days-fall-type2-type2.phpt b/ext/date/tests/DateTime_days-fall-type2-type2.phpt
new file mode 100644
index 0000000..3af156c
--- /dev/null
+++ b/ext/date/tests/DateTime_days-fall-type2-type2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DateTime::diff() days -- fall type2 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-fall-type2-type2.inc';
+
+?>
+--EXPECT--
+test_time_fall_type2_prev_type2_prev: DAYS: **33**
+test_time_fall_type2_prev_type2_dt: DAYS: **0**
+test_time_fall_type2_prev_type2_redodt: DAYS: **0**
+test_time_fall_type2_prev_type2_redost: DAYS: **0**
+test_time_fall_type2_prev_type2_st: DAYS: **0**
+test_time_fall_type2_prev_type2_post: DAYS: **2**
+test_time_fall_type2_dt_type2_prev: DAYS: **0**
+test_time_fall_type2_dt_type2_dt: DAYS: **0**
+test_time_fall_type2_dt_type2_redodt: DAYS: **0**
+test_time_fall_type2_dt_type2_redost: DAYS: **0**
+test_time_fall_type2_dt_type2_st: DAYS: **0**
+test_time_fall_type2_dt_type2_post: DAYS: **1**
+test_time_fall_type2_redodt_type2_prev: DAYS: **0**
+test_time_fall_type2_redodt_type2_dt: DAYS: **0**
+test_time_fall_type2_redodt_type2_redodt: DAYS: **0**
+test_time_fall_type2_redodt_type2_redost: DAYS: **0**
+test_time_fall_type2_redodt_type2_st: DAYS: **0**
+test_time_fall_type2_redodt_type2_post: DAYS: **1**
+test_time_fall_type2_redost_type2_prev: DAYS: **0**
+test_time_fall_type2_redost_type2_dt: DAYS: **0**
+test_time_fall_type2_redost_type2_redodt: DAYS: **0**
+test_time_fall_type2_redost_type2_redost: DAYS: **0**
+test_time_fall_type2_redost_type2_st: DAYS: **0**
+test_time_fall_type2_redost_type2_post: DAYS: **1**
+test_time_fall_type2_st_type2_prev: DAYS: **0**
+test_time_fall_type2_st_type2_dt: DAYS: **0**
+test_time_fall_type2_st_type2_redodt: DAYS: **0**
+test_time_fall_type2_st_type2_redost: DAYS: **0**
+test_time_fall_type2_st_type2_st: DAYS: **0**
+test_time_fall_type2_st_type2_post: DAYS: **1**
+test_time_fall_type2_post_type2_prev: DAYS: **2**
+test_time_fall_type2_post_type2_dt: DAYS: **1**
+test_time_fall_type2_post_type2_redodt: DAYS: **1**
+test_time_fall_type2_post_type2_redost: DAYS: **1**
+test_time_fall_type2_post_type2_st: DAYS: **1**
+test_time_fall_type2_post_type2_post: DAYS: **0**
+test_time_fall_type2_dtsec_type2_stsec: DAYS: **0**
+test_time_fall_type2_stsec_type2_dtsec: DAYS: **0**
diff --git a/ext/date/tests/DateTime_days-fall-type2-type3.phpt b/ext/date/tests/DateTime_days-fall-type2-type3.phpt
new file mode 100644
index 0000000..8a4296b
--- /dev/null
+++ b/ext/date/tests/DateTime_days-fall-type2-type3.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DateTime::diff() days -- fall type2 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-fall-type2-type3.inc';
+
+?>
+--EXPECT--
+test_time_fall_type2_prev_type3_prev: DAYS: **33**
+test_time_fall_type2_prev_type3_dt: DAYS: **0**
+test_time_fall_type2_prev_type3_redodt: DAYS: **0**
+test_time_fall_type2_prev_type3_redost: DAYS: **0**
+test_time_fall_type2_prev_type3_st: DAYS: **0**
+test_time_fall_type2_prev_type3_post: DAYS: **2**
+test_time_fall_type2_dt_type3_prev: DAYS: **0**
+test_time_fall_type2_dt_type3_dt: DAYS: **0**
+test_time_fall_type2_dt_type3_redodt: DAYS: **0**
+test_time_fall_type2_dt_type3_redost: DAYS: **0**
+test_time_fall_type2_dt_type3_st: DAYS: **0**
+test_time_fall_type2_dt_type3_post: DAYS: **1**
+test_time_fall_type2_redodt_type3_prev: DAYS: **0**
+test_time_fall_type2_redodt_type3_dt: DAYS: **0**
+test_time_fall_type2_redodt_type3_redodt: DAYS: **0**
+test_time_fall_type2_redodt_type3_redost: DAYS: **0**
+test_time_fall_type2_redodt_type3_st: DAYS: **0**
+test_time_fall_type2_redodt_type3_post: DAYS: **1**
+test_time_fall_type2_redost_type3_prev: DAYS: **0**
+test_time_fall_type2_redost_type3_dt: DAYS: **0**
+test_time_fall_type2_redost_type3_redodt: DAYS: **0**
+test_time_fall_type2_redost_type3_redost: DAYS: **0**
+test_time_fall_type2_redost_type3_st: DAYS: **0**
+test_time_fall_type2_redost_type3_post: DAYS: **1**
+test_time_fall_type2_st_type3_prev: DAYS: **0**
+test_time_fall_type2_st_type3_dt: DAYS: **0**
+test_time_fall_type2_st_type3_redodt: DAYS: **0**
+test_time_fall_type2_st_type3_redost: DAYS: **0**
+test_time_fall_type2_st_type3_st: DAYS: **0**
+test_time_fall_type2_st_type3_post: DAYS: **1**
+test_time_fall_type2_post_type3_prev: DAYS: **2**
+test_time_fall_type2_post_type3_dt: DAYS: **1**
+test_time_fall_type2_post_type3_redodt: DAYS: **1**
+test_time_fall_type2_post_type3_redost: DAYS: **1**
+test_time_fall_type2_post_type3_st: DAYS: **1**
+test_time_fall_type2_post_type3_post: DAYS: **0**
+test_time_fall_type2_dtsec_type3_stsec: DAYS: **0**
+test_time_fall_type2_stsec_type3_dtsec: DAYS: **0**
diff --git a/ext/date/tests/DateTime_days-fall-type3-type2.phpt b/ext/date/tests/DateTime_days-fall-type3-type2.phpt
new file mode 100644
index 0000000..d545603
--- /dev/null
+++ b/ext/date/tests/DateTime_days-fall-type3-type2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DateTime::diff() days -- fall type3 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-fall-type3-type2.inc';
+
+?>
+--EXPECT--
+test_time_fall_type3_prev_type2_prev: DAYS: **33**
+test_time_fall_type3_prev_type2_dt: DAYS: **0**
+test_time_fall_type3_prev_type2_redodt: DAYS: **0**
+test_time_fall_type3_prev_type2_redost: DAYS: **0**
+test_time_fall_type3_prev_type2_st: DAYS: **0**
+test_time_fall_type3_prev_type2_post: DAYS: **2**
+test_time_fall_type3_dt_type2_prev: DAYS: **0**
+test_time_fall_type3_dt_type2_dt: DAYS: **0**
+test_time_fall_type3_dt_type2_redodt: DAYS: **0**
+test_time_fall_type3_dt_type2_redost: DAYS: **0**
+test_time_fall_type3_dt_type2_st: DAYS: **0**
+test_time_fall_type3_dt_type2_post: DAYS: **1**
+test_time_fall_type3_redodt_type2_prev: DAYS: **0**
+test_time_fall_type3_redodt_type2_dt: DAYS: **0**
+test_time_fall_type3_redodt_type2_redodt: DAYS: **0**
+test_time_fall_type3_redodt_type2_redost: DAYS: **0**
+test_time_fall_type3_redodt_type2_st: DAYS: **0**
+test_time_fall_type3_redodt_type2_post: DAYS: **1**
+test_time_fall_type3_redost_type2_prev: DAYS: **0**
+test_time_fall_type3_redost_type2_dt: DAYS: **0**
+test_time_fall_type3_redost_type2_redodt: DAYS: **0**
+test_time_fall_type3_redost_type2_redost: DAYS: **0**
+test_time_fall_type3_redost_type2_st: DAYS: **0**
+test_time_fall_type3_redost_type2_post: DAYS: **1**
+test_time_fall_type3_st_type2_prev: DAYS: **0**
+test_time_fall_type3_st_type2_dt: DAYS: **0**
+test_time_fall_type3_st_type2_redodt: DAYS: **0**
+test_time_fall_type3_st_type2_redost: DAYS: **0**
+test_time_fall_type3_st_type2_st: DAYS: **0**
+test_time_fall_type3_st_type2_post: DAYS: **1**
+test_time_fall_type3_post_type2_prev: DAYS: **2**
+test_time_fall_type3_post_type2_dt: DAYS: **1**
+test_time_fall_type3_post_type2_redodt: DAYS: **1**
+test_time_fall_type3_post_type2_redost: DAYS: **1**
+test_time_fall_type3_post_type2_st: DAYS: **1**
+test_time_fall_type3_post_type2_post: DAYS: **0**
+test_time_fall_type3_dtsec_type2_stsec: DAYS: **0**
+test_time_fall_type3_stsec_type2_dtsec: DAYS: **0**
diff --git a/ext/date/tests/DateTime_days-fall-type3-type3.phpt b/ext/date/tests/DateTime_days-fall-type3-type3.phpt
new file mode 100644
index 0000000..38e4ef5
--- /dev/null
+++ b/ext/date/tests/DateTime_days-fall-type3-type3.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DateTime::diff() days -- fall type3 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-fall-type3-type3.inc';
+
+?>
+--EXPECT--
+test_time_fall_type3_prev_type3_prev: DAYS: **33**
+test_time_fall_type3_prev_type3_dt: DAYS: **0**
+test_time_fall_type3_prev_type3_redodt: DAYS: **0**
+test_time_fall_type3_prev_type3_redost: DAYS: **0**
+test_time_fall_type3_prev_type3_st: DAYS: **0**
+test_time_fall_type3_prev_type3_post: DAYS: **2**
+test_time_fall_type3_dt_type3_prev: DAYS: **0**
+test_time_fall_type3_dt_type3_dt: DAYS: **0**
+test_time_fall_type3_dt_type3_redodt: DAYS: **0**
+test_time_fall_type3_dt_type3_redost: DAYS: **0**
+test_time_fall_type3_dt_type3_st: DAYS: **0**
+test_time_fall_type3_dt_type3_post: DAYS: **1**
+test_time_fall_type3_redodt_type3_prev: DAYS: **0**
+test_time_fall_type3_redodt_type3_dt: DAYS: **0**
+test_time_fall_type3_redodt_type3_redodt: DAYS: **0**
+test_time_fall_type3_redodt_type3_redost: DAYS: **0**
+test_time_fall_type3_redodt_type3_st: DAYS: **0**
+test_time_fall_type3_redodt_type3_post: DAYS: **1**
+test_time_fall_type3_redost_type3_prev: DAYS: **0**
+test_time_fall_type3_redost_type3_dt: DAYS: **0**
+test_time_fall_type3_redost_type3_redodt: DAYS: **0**
+test_time_fall_type3_redost_type3_redost: DAYS: **0**
+test_time_fall_type3_redost_type3_st: DAYS: **0**
+test_time_fall_type3_redost_type3_post: DAYS: **1**
+test_time_fall_type3_st_type3_prev: DAYS: **0**
+test_time_fall_type3_st_type3_dt: DAYS: **0**
+test_time_fall_type3_st_type3_redodt: DAYS: **0**
+test_time_fall_type3_st_type3_redost: DAYS: **0**
+test_time_fall_type3_st_type3_st: DAYS: **0**
+test_time_fall_type3_st_type3_post: DAYS: **1**
+test_time_fall_type3_post_type3_prev: DAYS: **2**
+test_time_fall_type3_post_type3_dt: DAYS: **1**
+test_time_fall_type3_post_type3_redodt: DAYS: **1**
+test_time_fall_type3_post_type3_redost: DAYS: **1**
+test_time_fall_type3_post_type3_st: DAYS: **1**
+test_time_fall_type3_post_type3_post: DAYS: **0**
+test_time_fall_type3_dtsec_type3_stsec: DAYS: **0**
+test_time_fall_type3_stsec_type3_dtsec: DAYS: **0**
diff --git a/ext/date/tests/DateTime_days-february.phpt b/ext/date/tests/DateTime_days-february.phpt
new file mode 100644
index 0000000..b8107d7
--- /dev/null
+++ b/ext/date/tests/DateTime_days-february.phpt
@@ -0,0 +1,77 @@
+--TEST--
+DateTime::diff() days -- february
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-february.inc';
+
+?>
+--EXPECT--
+test_bug_49081__1: DAYS: **30**
+test_bug_49081__2: DAYS: **31**
+test_bug_49081__3: DAYS: **1**
+test_bug_49081__4: DAYS: **29**
+test_bug_49081__5: DAYS: **30**
+test_bug_49081__6: DAYS: **31**
+test_bug_49081__7: DAYS: **32**
+test_bug_49081__8: DAYS: **28**
+test_bug_49081__9: DAYS: **29**
+test_bug_49081__10: DAYS: **30**
+test_bug_49081__11: DAYS: **31**
+test_bug_49081__12: DAYS: **1**
+test_bug_49081__13: DAYS: **27**
+test_bug_49081__14: DAYS: **28**
+test_bug_49081__15: DAYS: **29**
+test_bug_49081__16: DAYS: **30**
+test_bug_49081__17: DAYS: **31**
+test_bug_49081__18: DAYS: **32**
+test_bug_49081__19: DAYS: **59**
+test_bug_49081__20: DAYS: **29**
+test_bug_49081__21: DAYS: **55**
+test_bug_49081__22: DAYS: **56**
+test_bug_49081__23: DAYS: **57**
+test_bug_49081__24: DAYS: **58**
+test_bug_49081__25: DAYS: **59**
+test_bug_49081__26: DAYS: **60**
+test_bug_49081__27: DAYS: **30**
+test_bug_49081__28: DAYS: **27**
+test_bug_49081__29: DAYS: **28**
+test_bug_49081__30: DAYS: **29**
+test_bug_49081__31: DAYS: **28**
+test_bug_49081__32: DAYS: **29**
+test_bug_49081_negative__1: DAYS: **30**
+test_bug_49081_negative__2: DAYS: **31**
+test_bug_49081_negative__3: DAYS: **1**
+test_bug_49081_negative__4: DAYS: **29**
+test_bug_49081_negative__5: DAYS: **30**
+test_bug_49081_negative__6: DAYS: **31**
+test_bug_49081_negative__7: DAYS: **32**
+test_bug_49081_negative__8: DAYS: **28**
+test_bug_49081_negative__9: DAYS: **29**
+test_bug_49081_negative__10: DAYS: **30**
+test_bug_49081_negative__11: DAYS: **31**
+test_bug_49081_negative__12: DAYS: **1**
+test_bug_49081_negative__13: DAYS: **27**
+test_bug_49081_negative__14: DAYS: **28**
+test_bug_49081_negative__15: DAYS: **29**
+test_bug_49081_negative__16: DAYS: **30**
+test_bug_49081_negative__17: DAYS: **31**
+test_bug_49081_negative__18: DAYS: **32**
+test_bug_49081_negative__19: DAYS: **59**
+test_bug_49081_negative__20: DAYS: **29**
+test_bug_49081_negative__21: DAYS: **55**
+test_bug_49081_negative__22: DAYS: **56**
+test_bug_49081_negative__23: DAYS: **57**
+test_bug_49081_negative__24: DAYS: **58**
+test_bug_49081_negative__25: DAYS: **59**
+test_bug_49081_negative__26: DAYS: **60**
+test_bug_49081_negative__27: DAYS: **30**
+test_bug_49081_negative__28: DAYS: **27**
+test_bug_49081_negative__29: DAYS: **28**
+test_bug_49081_negative__30: DAYS: **29**
+test_bug_49081_negative__31: DAYS: **28**
+test_bug_49081_negative__32: DAYS: **29**
diff --git a/ext/date/tests/DateTime_days-massive.phpt b/ext/date/tests/DateTime_days-massive.phpt
new file mode 100644
index 0000000..de51a66
--- /dev/null
+++ b/ext/date/tests/DateTime_days-massive.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DateTime::diff() days -- massive
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-massive.inc';
+
+?>
+--EXPECT--
+test_massive_positive: DAYS: **243494757**
+test_massive_negative: DAYS: **243494757**
diff --git a/ext/date/tests/DateTime_days-spring-type2-type2.phpt b/ext/date/tests/DateTime_days-spring-type2-type2.phpt
new file mode 100644
index 0000000..3e702ac
--- /dev/null
+++ b/ext/date/tests/DateTime_days-spring-type2-type2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DateTime::diff() days -- spring type2 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-spring-type2-type2.inc';
+
+?>
+--EXPECT--
+test_time_spring_type2_prev_type2_prev: DAYS: **30**
+test_time_spring_type2_prev_type2_st: DAYS: **0**
+test_time_spring_type2_prev_type2_dt: DAYS: **0**
+test_time_spring_type2_prev_type2_post: DAYS: **2**
+test_time_spring_type2_st_type2_prev: DAYS: **0**
+test_time_spring_type2_st_type2_st: DAYS: **0**
+test_time_spring_type2_st_type2_dt: DAYS: **0**
+test_time_spring_type2_st_type2_post: DAYS: **1**
+test_time_spring_type2_dt_type2_prev: DAYS: **0**
+test_time_spring_type2_dt_type2_st: DAYS: **0**
+test_time_spring_type2_dt_type2_dt: DAYS: **0**
+test_time_spring_type2_dt_type2_post: DAYS: **1**
+test_time_spring_type2_post_type2_prev: DAYS: **2**
+test_time_spring_type2_post_type2_st: DAYS: **1**
+test_time_spring_type2_post_type2_dt: DAYS: **1**
+test_time_spring_type2_post_type2_post: DAYS: **0**
+test_time_spring_type2_stsec_type2_dtsec: DAYS: **0**
+test_time_spring_type2_dtsec_type2_stsec: DAYS: **0**
diff --git a/ext/date/tests/DateTime_days-spring-type2-type3.phpt b/ext/date/tests/DateTime_days-spring-type2-type3.phpt
new file mode 100644
index 0000000..0e23ac3
--- /dev/null
+++ b/ext/date/tests/DateTime_days-spring-type2-type3.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DateTime::diff() days -- spring type2 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-spring-type2-type3.inc';
+
+?>
+--EXPECT--
+test_time_spring_type2_prev_type3_prev: DAYS: **30**
+test_time_spring_type2_prev_type3_st: DAYS: **0**
+test_time_spring_type2_prev_type3_dt: DAYS: **0**
+test_time_spring_type2_prev_type3_post: DAYS: **2**
+test_time_spring_type2_st_type3_prev: DAYS: **0**
+test_time_spring_type2_st_type3_st: DAYS: **0**
+test_time_spring_type2_st_type3_dt: DAYS: **0**
+test_time_spring_type2_st_type3_post: DAYS: **1**
+test_time_spring_type2_dt_type3_prev: DAYS: **0**
+test_time_spring_type2_dt_type3_st: DAYS: **0**
+test_time_spring_type2_dt_type3_dt: DAYS: **0**
+test_time_spring_type2_dt_type3_post: DAYS: **1**
+test_time_spring_type2_post_type3_prev: DAYS: **2**
+test_time_spring_type2_post_type3_st: DAYS: **1**
+test_time_spring_type2_post_type3_dt: DAYS: **1**
+test_time_spring_type2_post_type3_post: DAYS: **0**
+test_time_spring_type2_stsec_type3_dtsec: DAYS: **0**
+test_time_spring_type2_dtsec_type3_stsec: DAYS: **0**
diff --git a/ext/date/tests/DateTime_days-spring-type3-type2.phpt b/ext/date/tests/DateTime_days-spring-type3-type2.phpt
new file mode 100644
index 0000000..4fb9ba7
--- /dev/null
+++ b/ext/date/tests/DateTime_days-spring-type3-type2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DateTime::diff() days -- spring type3 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-spring-type3-type2.inc';
+
+?>
+--EXPECT--
+test_time_spring_type3_prev_type2_prev: DAYS: **30**
+test_time_spring_type3_prev_type2_st: DAYS: **0**
+test_time_spring_type3_prev_type2_dt: DAYS: **0**
+test_time_spring_type3_prev_type2_post: DAYS: **2**
+test_time_spring_type3_st_type2_prev: DAYS: **0**
+test_time_spring_type3_st_type2_st: DAYS: **0**
+test_time_spring_type3_st_type2_dt: DAYS: **0**
+test_time_spring_type3_st_type2_post: DAYS: **1**
+test_time_spring_type3_dt_type2_prev: DAYS: **0**
+test_time_spring_type3_dt_type2_st: DAYS: **0**
+test_time_spring_type3_dt_type2_dt: DAYS: **0**
+test_time_spring_type3_dt_type2_post: DAYS: **1**
+test_time_spring_type3_post_type2_prev: DAYS: **2**
+test_time_spring_type3_post_type2_st: DAYS: **1**
+test_time_spring_type3_post_type2_dt: DAYS: **1**
+test_time_spring_type3_post_type2_post: DAYS: **0**
+test_time_spring_type3_stsec_type2_dtsec: DAYS: **0**
+test_time_spring_type3_dtsec_type2_stsec: DAYS: **0**
diff --git a/ext/date/tests/DateTime_days-spring-type3-type3.phpt b/ext/date/tests/DateTime_days-spring-type3-type3.phpt
new file mode 100644
index 0000000..df44925
--- /dev/null
+++ b/ext/date/tests/DateTime_days-spring-type3-type3.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DateTime::diff() days -- spring type3 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DAYS);
+require 'DateTime_data-spring-type3-type3.inc';
+
+?>
+--EXPECT--
+test_time_spring_type3_prev_type3_prev: DAYS: **30**
+test_time_spring_type3_prev_type3_st: DAYS: **0**
+test_time_spring_type3_prev_type3_dt: DAYS: **0**
+test_time_spring_type3_prev_type3_post: DAYS: **2**
+test_time_spring_type3_st_type3_prev: DAYS: **0**
+test_time_spring_type3_st_type3_st: DAYS: **0**
+test_time_spring_type3_st_type3_dt: DAYS: **0**
+test_time_spring_type3_st_type3_post: DAYS: **1**
+test_time_spring_type3_dt_type3_prev: DAYS: **0**
+test_time_spring_type3_dt_type3_st: DAYS: **0**
+test_time_spring_type3_dt_type3_dt: DAYS: **0**
+test_time_spring_type3_dt_type3_post: DAYS: **1**
+test_time_spring_type3_post_type3_prev: DAYS: **2**
+test_time_spring_type3_post_type3_st: DAYS: **1**
+test_time_spring_type3_post_type3_dt: DAYS: **1**
+test_time_spring_type3_post_type3_post: DAYS: **0**
+test_time_spring_type3_stsec_type3_dtsec: DAYS: **0**
+test_time_spring_type3_dtsec_type3_stsec: DAYS: **0**
diff --git a/ext/date/tests/DateTime_diff-absolute.phpt b/ext/date/tests/DateTime_diff-absolute.phpt
new file mode 100644
index 0000000..5295b3a
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-absolute.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DateTime::diff() -- absolute
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-absolute.inc';
+
+?>
+--EXPECT--
+test_absolute_7: DIFF: 2009-01-14 00:00:00 EST - 2009-01-07 00:00:00 EST = **P+0Y0M7DT0H0M0S**
+test_absolute_negative_7: DIFF: 2009-01-07 00:00:00 EST - 2009-01-14 00:00:00 EST = **P+0Y0M7DT0H0M0S**
diff --git a/ext/date/tests/DateTime_diff-dates.phpt b/ext/date/tests/DateTime_diff-dates.phpt
new file mode 100644
index 0000000..71c5e1b
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-dates.phpt
@@ -0,0 +1,29 @@
+--TEST--
+DateTime::diff() -- dates
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-dates.inc';
+
+?>
+--EXPECT--
+test__7: DIFF: 2009-01-14 00:00:00 EST - 2009-01-07 00:00:00 EST = **P+0Y0M7DT0H0M0S**
+test_years_positive__7_by_0_day: DIFF: 2007-02-07 00:00:00 EST - 2000-02-07 00:00:00 EST = **P+7Y0M0DT0H0M0S**
+test_years_positive__7_by_1_day: DIFF: 2007-02-08 00:00:00 EST - 2000-02-07 00:00:00 EST = **P+7Y0M1DT0H0M0S**
+test_years_positive__6_shy_1_day: DIFF: 2007-02-06 00:00:00 EST - 2000-02-07 00:00:00 EST = **P+6Y11M30DT0H0M0S**
+test_years_positive__7_by_1_month: DIFF: 2007-03-07 00:00:00 EST - 2000-02-07 00:00:00 EST = **P+7Y1M0DT0H0M0S**
+test_years_positive__6_shy_1_month: DIFF: 2007-01-07 00:00:00 EST - 2000-02-07 00:00:00 EST = **P+6Y11M0DT0H0M0S**
+test_years_positive__7_by_1_month_split_newyear: DIFF: 2007-01-07 00:00:00 EST - 1999-12-07 00:00:00 EST = **P+7Y1M0DT0H0M0S**
+test_years_positive__6_shy_1_month_split_newyear: DIFF: 2006-12-07 00:00:00 EST - 2000-01-07 00:00:00 EST = **P+6Y11M0DT0H0M0S**
+test_negative__7: DIFF: 2009-01-07 00:00:00 EST - 2009-01-14 00:00:00 EST = **P-0Y0M7DT0H0M0S**
+test_years_negative__7_by_0_day: DIFF: 2000-02-07 00:00:00 EST - 2007-02-07 00:00:00 EST = **P-7Y0M0DT0H0M0S**
+test_years_negative__7_by_1_day: DIFF: 2000-02-07 00:00:00 EST - 2007-02-08 00:00:00 EST = **P-7Y0M1DT0H0M0S**
+test_years_negative__6_shy_1_day: DIFF: 2000-02-07 00:00:00 EST - 2007-02-06 00:00:00 EST = **P-6Y11M28DT0H0M0S**
+test_years_negative__7_by_1_month: DIFF: 2000-02-07 00:00:00 EST - 2007-03-07 00:00:00 EST = **P-7Y1M0DT0H0M0S**
+test_years_negative__6_shy_1_month: DIFF: 2000-02-07 00:00:00 EST - 2007-01-07 00:00:00 EST = **P-6Y11M0DT0H0M0S**
+test_years_negative__7_by_1_month_split_newyear: DIFF: 1999-12-07 00:00:00 EST - 2007-01-07 00:00:00 EST = **P-7Y1M0DT0H0M0S**
+test_years_negative__6_shy_1_month_split_newyear: DIFF: 2000-01-07 00:00:00 EST - 2006-12-07 00:00:00 EST = **P-6Y11M0DT0H0M0S**
diff --git a/ext/date/tests/DateTime_diff-fall-type2-type2.phpt b/ext/date/tests/DateTime_diff-fall-type2-type2.phpt
new file mode 100644
index 0000000..d655637
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-fall-type2-type2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DateTime::diff() -- fall type2 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-fall-type2-type2.inc';
+
+?>
+--EXPECT--
+test_time_fall_type2_prev_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-10-04 02:18:48 EDT = **P+0Y1M2DT16H19M40S**
+test_time_fall_type2_prev_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT5H31M52S**
+test_time_fall_type2_prev_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT6H34M5S**
+test_time_fall_type2_prev_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT7H36M16S**
+test_time_fall_type2_prev_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT9H38M27S**
+test_time_fall_type2_prev_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M2DT2H21M31S**
+test_time_fall_type2_dt_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 00:10:20 EDT = **P-0Y0M0DT5H31M52S**
+test_time_fall_type2_dt_type2_dt: DIFF: 2010-11-07 00:15:35 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT0H5M15S**
+test_time_fall_type2_dt_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT1H2M13S**
+test_time_fall_type2_dt_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT2H4M24S**
+test_time_fall_type2_dt_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT4H6M35S**
+test_time_fall_type2_dt_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M1DT20H49M39S**
+test_time_fall_type2_redodt_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT6H34M5S**
+test_time_fall_type2_redodt_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT1H2M13S**
+test_time_fall_type2_redodt_type2_redodt: DIFF: 2010-11-07 01:15:35 EDT - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT0H3M2S**
+test_time_fall_type2_redodt_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT1H2M11S**
+test_time_fall_type2_redodt_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT3H4M22S**
+test_time_fall_type2_redodt_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M1DT19H47M26S**
+test_time_fall_type2_redost_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT7H36M16S**
+test_time_fall_type2_redost_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT2H4M24S**
+test_time_fall_type2_redost_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT1H2M11S**
+test_time_fall_type2_redost_type2_redost: DIFF: 2010-11-07 01:16:54 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT0H2M10S**
+test_time_fall_type2_redost_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT2H2M11S**
+test_time_fall_type2_redost_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:14:44 EST = **P+0Y0M1DT18H45M15S**
+test_time_fall_type2_st_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT9H38M27S**
+test_time_fall_type2_st_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT4H6M35S**
+test_time_fall_type2_st_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT3H4M22S**
+test_time_fall_type2_st_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 03:16:55 EST = **P-0Y0M0DT2H2M11S**
+test_time_fall_type2_st_type2_st: DIFF: 2010-11-07 05:19:56 EST - 2010-11-07 03:16:55 EST = **P+0Y0M0DT2H3M1S**
+test_time_fall_type2_st_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 03:16:55 EST = **P+0Y0M1DT16H43M4S**
+test_time_fall_type2_post_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M2DT2H21M31S**
+test_time_fall_type2_post_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT20H49M39S**
+test_time_fall_type2_post_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT19H47M26S**
+test_time_fall_type2_post_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT18H45M15S**
+test_time_fall_type2_post_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT16H43M4S**
+test_time_fall_type2_post_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-08 18:57:55 EST = **P+0Y0M0DT1H2M4S**
+test_time_fall_type2_dtsec_type2_stsec: DIFF: 2010-11-07 01:00:00 EST - 2010-11-07 01:59:59 EDT = **P+0Y0M0DT0H0M1S**
+test_time_fall_type2_stsec_type2_dtsec: DIFF: 2010-11-07 01:59:59 EDT - 2010-11-07 01:00:00 EST = **P-0Y0M0DT0H0M1S**
diff --git a/ext/date/tests/DateTime_diff-fall-type2-type3.phpt b/ext/date/tests/DateTime_diff-fall-type2-type3.phpt
new file mode 100644
index 0000000..ec790f0
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-fall-type2-type3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::diff() -- fall type2 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-fall-type2-type3.inc';
+
+?>
+--EXPECT--
+test_time_fall_type2_prev_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-10-04 02:18:48 EDT = **P+0Y1M2DT16H19M40S**
+test_time_fall_type2_prev_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT5H31M52S**
+test_time_fall_type2_prev_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT6H34M5S**
+test_time_fall_type2_prev_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT7H36M16S**
+test_time_fall_type2_prev_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT9H38M27S**
+test_time_fall_type2_prev_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M2DT1H21M31S**
+test_time_fall_type2_dt_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 00:10:20 EDT = **P-0Y0M0DT5H31M52S**
+test_time_fall_type2_dt_type3_dt: DIFF: 2010-11-07 00:15:35 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT0H5M15S**
+test_time_fall_type2_dt_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT1H2M13S**
+test_time_fall_type2_dt_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT2H4M24S**
+test_time_fall_type2_dt_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT4H6M35S**
+test_time_fall_type2_dt_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M1DT20H49M39S**
+test_time_fall_type2_redodt_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT6H34M5S**
+test_time_fall_type2_redodt_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT1H2M13S**
+test_time_fall_type2_redodt_type3_redodt: DIFF: 2010-11-07 01:15:35 EDT - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT0H3M2S**
+test_time_fall_type2_redodt_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT1H2M11S**
+test_time_fall_type2_redodt_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT3H4M22S**
+test_time_fall_type2_redodt_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M1DT19H47M26S**
+test_time_fall_type2_redost_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT7H36M16S**
+test_time_fall_type2_redost_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT2H4M24S**
+test_time_fall_type2_redost_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT1H2M11S**
+test_time_fall_type2_redost_type3_redost: DIFF: 2010-11-07 01:16:54 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT0H2M10S**
+test_time_fall_type2_redost_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT2H2M11S**
+test_time_fall_type2_redost_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:14:44 EST = **P+0Y0M1DT18H45M15S**
+test_time_fall_type2_st_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT9H38M27S**
+test_time_fall_type2_st_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT4H6M35S**
+test_time_fall_type2_st_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT3H4M22S**
+test_time_fall_type2_st_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 03:16:55 EST = **P-0Y0M0DT2H2M11S**
+test_time_fall_type2_st_type3_st: DIFF: 2010-11-07 05:19:56 EST - 2010-11-07 03:16:55 EST = **P+0Y0M0DT2H3M1S**
+test_time_fall_type2_st_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 03:16:55 EST = **P+0Y0M1DT16H43M4S**
+test_time_fall_type2_post_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M2DT1H21M31S**
+test_time_fall_type2_post_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT20H49M39S**
+test_time_fall_type2_post_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT19H47M26S**
+test_time_fall_type2_post_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT18H45M15S**
+test_time_fall_type2_post_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT16H43M4S**
+test_time_fall_type2_post_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-08 18:57:55 EST = **P+0Y0M0DT1H2M4S**
+test_time_fall_type2_dtsec_type3_stsec: DIFF: 2010-11-07 01:00:00 EST - 2010-11-07 01:59:59 EDT = **P+0Y0M0DT0H0M1S**
+test_time_fall_type2_stsec_type3_dtsec: DIFF: 2010-11-07 01:59:59 EDT - 2010-11-07 01:00:00 EST = **P-0Y0M0DT0H0M1S**
diff --git a/ext/date/tests/DateTime_diff-fall-type3-type2.phpt b/ext/date/tests/DateTime_diff-fall-type3-type2.phpt
new file mode 100644
index 0000000..c9f268f
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-fall-type3-type2.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::diff() -- fall type3 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-fall-type3-type2.inc';
+
+?>
+--EXPECT--
+test_time_fall_type3_prev_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-10-04 02:18:48 EDT = **P+0Y1M2DT16H19M40S**
+test_time_fall_type3_prev_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT5H31M52S**
+test_time_fall_type3_prev_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT6H34M5S**
+test_time_fall_type3_prev_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT7H36M16S**
+test_time_fall_type3_prev_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT9H38M27S**
+test_time_fall_type3_prev_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M2DT1H21M31S**
+test_time_fall_type3_dt_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 00:10:20 EDT = **P-0Y0M0DT5H31M52S**
+test_time_fall_type3_dt_type2_dt: DIFF: 2010-11-07 00:15:35 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT0H5M15S**
+test_time_fall_type3_dt_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT1H2M13S**
+test_time_fall_type3_dt_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT2H4M24S**
+test_time_fall_type3_dt_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT4H6M35S**
+test_time_fall_type3_dt_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M1DT20H49M39S**
+test_time_fall_type3_redodt_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT6H34M5S**
+test_time_fall_type3_redodt_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT1H2M13S**
+test_time_fall_type3_redodt_type2_redodt: DIFF: 2010-11-07 01:15:35 EDT - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT0H3M2S**
+test_time_fall_type3_redodt_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT1H2M11S**
+test_time_fall_type3_redodt_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT3H4M22S**
+test_time_fall_type3_redodt_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M1DT19H47M26S**
+test_time_fall_type3_redost_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT7H36M16S**
+test_time_fall_type3_redost_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT2H4M24S**
+test_time_fall_type3_redost_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT1H2M11S**
+test_time_fall_type3_redost_type2_redost: DIFF: 2010-11-07 01:16:54 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT0H2M10S**
+test_time_fall_type3_redost_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT2H2M11S**
+test_time_fall_type3_redost_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:14:44 EST = **P+0Y0M1DT18H45M15S**
+test_time_fall_type3_st_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT9H38M27S**
+test_time_fall_type3_st_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT4H6M35S**
+test_time_fall_type3_st_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT3H4M22S**
+test_time_fall_type3_st_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 03:16:55 EST = **P-0Y0M0DT2H2M11S**
+test_time_fall_type3_st_type2_st: DIFF: 2010-11-07 05:19:56 EST - 2010-11-07 03:16:55 EST = **P+0Y0M0DT2H3M1S**
+test_time_fall_type3_st_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 03:16:55 EST = **P+0Y0M1DT16H43M4S**
+test_time_fall_type3_post_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M2DT1H21M31S**
+test_time_fall_type3_post_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT20H49M39S**
+test_time_fall_type3_post_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT19H47M26S**
+test_time_fall_type3_post_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT18H45M15S**
+test_time_fall_type3_post_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT16H43M4S**
+test_time_fall_type3_post_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-08 18:57:55 EST = **P+0Y0M0DT1H2M4S**
+test_time_fall_type3_dtsec_type2_stsec: DIFF: 2010-11-07 01:00:00 EST - 2010-11-07 01:59:59 EDT = **P+0Y0M0DT0H0M1S**
+test_time_fall_type3_stsec_type2_dtsec: DIFF: 2010-11-07 01:59:59 EDT - 2010-11-07 01:00:00 EST = **P-0Y0M0DT0H0M1S**
diff --git a/ext/date/tests/DateTime_diff-fall-type3-type3.phpt b/ext/date/tests/DateTime_diff-fall-type3-type3.phpt
new file mode 100644
index 0000000..bf25fef
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-fall-type3-type3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::diff() -- fall type3 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-fall-type3-type3.inc';
+
+?>
+--EXPECT--
+test_time_fall_type3_prev_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-10-04 02:18:48 EDT = **P+0Y1M2DT16H19M40S**
+test_time_fall_type3_prev_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT5H31M52S**
+test_time_fall_type3_prev_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT6H34M5S**
+test_time_fall_type3_prev_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT7H36M16S**
+test_time_fall_type3_prev_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT9H38M27S**
+test_time_fall_type3_prev_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M2DT1H21M31S**
+test_time_fall_type3_dt_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 00:10:20 EDT = **P-0Y0M0DT5H31M52S**
+test_time_fall_type3_dt_type3_dt: DIFF: 2010-11-07 00:15:35 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT0H5M15S**
+test_time_fall_type3_dt_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT1H2M13S**
+test_time_fall_type3_dt_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT2H4M24S**
+test_time_fall_type3_dt_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT4H6M35S**
+test_time_fall_type3_dt_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M1DT20H49M39S**
+test_time_fall_type3_redodt_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT6H34M5S**
+test_time_fall_type3_redodt_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT1H2M13S**
+test_time_fall_type3_redodt_type3_redodt: DIFF: 2010-11-07 01:15:35 EDT - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT0H3M2S**
+test_time_fall_type3_redodt_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT1H2M11S**
+test_time_fall_type3_redodt_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT3H4M22S**
+test_time_fall_type3_redodt_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M1DT19H47M26S**
+test_time_fall_type3_redost_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT7H36M16S**
+test_time_fall_type3_redost_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT2H4M24S**
+test_time_fall_type3_redost_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT1H2M11S**
+test_time_fall_type3_redost_type3_redost: DIFF: 2010-11-07 01:16:54 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT0H2M10S**
+test_time_fall_type3_redost_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT2H2M11S**
+test_time_fall_type3_redost_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:14:44 EST = **P+0Y0M1DT18H45M15S**
+test_time_fall_type3_st_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT9H38M27S**
+test_time_fall_type3_st_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT4H6M35S**
+test_time_fall_type3_st_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT3H4M22S**
+test_time_fall_type3_st_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 03:16:55 EST = **P-0Y0M0DT2H2M11S**
+test_time_fall_type3_st_type3_st: DIFF: 2010-11-07 05:19:56 EST - 2010-11-07 03:16:55 EST = **P+0Y0M0DT2H3M1S**
+test_time_fall_type3_st_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 03:16:55 EST = **P+0Y0M1DT16H43M4S**
+test_time_fall_type3_post_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M2DT1H21M31S**
+test_time_fall_type3_post_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT20H49M39S**
+test_time_fall_type3_post_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT19H47M26S**
+test_time_fall_type3_post_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT18H45M15S**
+test_time_fall_type3_post_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT16H43M4S**
+test_time_fall_type3_post_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-08 18:57:55 EST = **P+0Y0M0DT1H2M4S**
+test_time_fall_type3_dtsec_type3_stsec: DIFF: 2010-11-07 01:00:00 EST - 2010-11-07 01:59:59 EDT = **P+0Y0M0DT0H0M1S**
+test_time_fall_type3_stsec_type3_dtsec: DIFF: 2010-11-07 01:59:59 EDT - 2010-11-07 01:00:00 EST = **P-0Y0M0DT0H0M1S**
diff --git a/ext/date/tests/DateTime_diff-february.phpt b/ext/date/tests/DateTime_diff-february.phpt
new file mode 100644
index 0000000..7705b12
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-february.phpt
@@ -0,0 +1,77 @@
+--TEST--
+DateTime::diff() -- february
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-february.inc';
+
+?>
+--EXPECT--
+test_bug_49081__1: DIFF: 2010-03-31 00:00:00 EDT - 2010-03-01 00:00:00 EST = **P+0Y0M30DT0H0M0S**
+test_bug_49081__2: DIFF: 2010-04-01 00:00:00 EDT - 2010-03-01 00:00:00 EST = **P+0Y1M0DT0H0M0S**
+test_bug_49081__3: DIFF: 2010-04-01 00:00:00 EDT - 2010-03-31 00:00:00 EDT = **P+0Y0M1DT0H0M0S**
+test_bug_49081__4: DIFF: 2010-04-29 00:00:00 EDT - 2010-03-31 00:00:00 EDT = **P+0Y0M29DT0H0M0S**
+test_bug_49081__5: DIFF: 2010-04-30 00:00:00 EDT - 2010-03-31 00:00:00 EDT = **P+0Y0M30DT0H0M0S**
+test_bug_49081__6: DIFF: 2010-04-30 00:00:00 EDT - 2010-03-30 00:00:00 EDT = **P+0Y1M0DT0H0M0S**
+test_bug_49081__7: DIFF: 2010-04-30 00:00:00 EDT - 2010-03-29 00:00:00 EDT = **P+0Y1M1DT0H0M0S**
+test_bug_49081__8: DIFF: 2010-01-29 00:00:00 EST - 2010-01-01 00:00:00 EST = **P+0Y0M28DT0H0M0S**
+test_bug_49081__9: DIFF: 2010-01-30 00:00:00 EST - 2010-01-01 00:00:00 EST = **P+0Y0M29DT0H0M0S**
+test_bug_49081__10: DIFF: 2010-01-31 00:00:00 EST - 2010-01-01 00:00:00 EST = **P+0Y0M30DT0H0M0S**
+test_bug_49081__11: DIFF: 2010-02-01 00:00:00 EST - 2010-01-01 00:00:00 EST = **P+0Y1M0DT0H0M0S**
+test_bug_49081__12: DIFF: 2010-02-01 00:00:00 EST - 2010-01-31 00:00:00 EST = **P+0Y0M1DT0H0M0S**
+test_bug_49081__13: DIFF: 2010-02-27 00:00:00 EST - 2010-01-31 00:00:00 EST = **P+0Y0M27DT0H0M0S**
+test_bug_49081__14: DIFF: 2010-02-28 00:00:00 EST - 2010-01-31 00:00:00 EST = **P+0Y0M28DT0H0M0S**
+test_bug_49081__15: DIFF: 2010-02-28 00:00:00 EST - 2010-01-30 00:00:00 EST = **P+0Y0M29DT0H0M0S**
+test_bug_49081__16: DIFF: 2010-02-28 00:00:00 EST - 2010-01-29 00:00:00 EST = **P+0Y0M30DT0H0M0S**
+test_bug_49081__17: DIFF: 2010-02-28 00:00:00 EST - 2010-01-28 00:00:00 EST = **P+0Y1M0DT0H0M0S**
+test_bug_49081__18: DIFF: 2010-02-28 00:00:00 EST - 2010-01-27 00:00:00 EST = **P+0Y1M1DT0H0M0S**
+test_bug_49081__19: DIFF: 2010-03-01 00:00:00 EST - 2010-01-01 00:00:00 EST = **P+0Y2M0DT0H0M0S**
+test_bug_49081__20: DIFF: 2010-03-01 00:00:00 EST - 2010-01-31 00:00:00 EST = **P+0Y0M29DT0H0M0S**
+test_bug_49081__21: DIFF: 2010-03-27 00:00:00 EDT - 2010-01-31 00:00:00 EST = **P+0Y1M24DT0H0M0S**
+test_bug_49081__22: DIFF: 2010-03-28 00:00:00 EDT - 2010-01-31 00:00:00 EST = **P+0Y1M25DT0H0M0S**
+test_bug_49081__23: DIFF: 2010-03-29 00:00:00 EDT - 2010-01-31 00:00:00 EST = **P+0Y1M26DT0H0M0S**
+test_bug_49081__24: DIFF: 2010-03-30 00:00:00 EDT - 2010-01-31 00:00:00 EST = **P+0Y1M27DT0H0M0S**
+test_bug_49081__25: DIFF: 2010-03-31 00:00:00 EDT - 2010-01-31 00:00:00 EST = **P+0Y2M0DT0H0M0S**
+test_bug_49081__26: DIFF: 2010-03-31 00:00:00 EDT - 2010-01-30 00:00:00 EST = **P+0Y2M1DT0H0M0S**
+test_bug_49081__27: DIFF: 2009-01-31 00:00:00 EST - 2009-01-01 00:00:00 EST = **P+0Y0M30DT0H0M0S**
+test_bug_49081__28: DIFF: 2010-03-27 00:00:00 EDT - 2010-02-28 00:00:00 EST = **P+0Y0M27DT0H0M0S**
+test_bug_49081__29: DIFF: 2010-03-28 00:00:00 EDT - 2010-02-28 00:00:00 EST = **P+0Y1M0DT0H0M0S**
+test_bug_49081__30: DIFF: 2010-03-29 00:00:00 EDT - 2010-02-28 00:00:00 EST = **P+0Y1M1DT0H0M0S**
+test_bug_49081__31: DIFF: 2010-03-27 00:00:00 EDT - 2010-02-27 00:00:00 EST = **P+0Y1M0DT0H0M0S**
+test_bug_49081__32: DIFF: 2010-03-27 00:00:00 EDT - 2010-02-26 00:00:00 EST = **P+0Y1M1DT0H0M0S**
+test_bug_49081_negative__1: DIFF: 2010-03-01 00:00:00 EST - 2010-03-31 00:00:00 EDT = **P-0Y0M30DT0H0M0S**
+test_bug_49081_negative__2: DIFF: 2010-03-01 00:00:00 EST - 2010-04-01 00:00:00 EDT = **P-0Y1M0DT0H0M0S**
+test_bug_49081_negative__3: DIFF: 2010-03-31 00:00:00 EDT - 2010-04-01 00:00:00 EDT = **P-0Y0M1DT0H0M0S**
+test_bug_49081_negative__4: DIFF: 2010-03-31 00:00:00 EDT - 2010-04-29 00:00:00 EDT = **P-0Y0M29DT0H0M0S**
+test_bug_49081_negative__5: DIFF: 2010-03-31 00:00:00 EDT - 2010-04-30 00:00:00 EDT = **P-0Y0M30DT0H0M0S**
+test_bug_49081_negative__6: DIFF: 2010-03-30 00:00:00 EDT - 2010-04-30 00:00:00 EDT = **P-0Y1M0DT0H0M0S**
+test_bug_49081_negative__7: DIFF: 2010-03-29 00:00:00 EDT - 2010-04-30 00:00:00 EDT = **P-0Y1M1DT0H0M0S**
+test_bug_49081_negative__8: DIFF: 2010-01-01 00:00:00 EST - 2010-01-29 00:00:00 EST = **P-0Y0M28DT0H0M0S**
+test_bug_49081_negative__9: DIFF: 2010-01-01 00:00:00 EST - 2010-01-30 00:00:00 EST = **P-0Y0M29DT0H0M0S**
+test_bug_49081_negative__10: DIFF: 2010-01-01 00:00:00 EST - 2010-01-31 00:00:00 EST = **P-0Y0M30DT0H0M0S**
+test_bug_49081_negative__11: DIFF: 2010-01-01 00:00:00 EST - 2010-02-01 00:00:00 EST = **P-0Y1M0DT0H0M0S**
+test_bug_49081_negative__12: DIFF: 2010-01-31 00:00:00 EST - 2010-02-01 00:00:00 EST = **P-0Y0M1DT0H0M0S**
+test_bug_49081_negative__13: DIFF: 2010-01-31 00:00:00 EST - 2010-02-27 00:00:00 EST = **P-0Y0M27DT0H0M0S**
+test_bug_49081_negative__14: DIFF: 2010-01-31 00:00:00 EST - 2010-02-28 00:00:00 EST = **P-0Y0M28DT0H0M0S**
+test_bug_49081_negative__15: DIFF: 2010-01-30 00:00:00 EST - 2010-02-28 00:00:00 EST = **P-0Y0M29DT0H0M0S**
+test_bug_49081_negative__16: DIFF: 2010-01-29 00:00:00 EST - 2010-02-28 00:00:00 EST = **P-0Y0M30DT0H0M0S**
+test_bug_49081_negative__17: DIFF: 2010-01-28 00:00:00 EST - 2010-02-28 00:00:00 EST = **P-0Y1M0DT0H0M0S**
+test_bug_49081_negative__18: DIFF: 2010-01-27 00:00:00 EST - 2010-02-28 00:00:00 EST = **P-0Y1M1DT0H0M0S**
+test_bug_49081_negative__19: DIFF: 2010-01-01 00:00:00 EST - 2010-03-01 00:00:00 EST = **P-0Y2M0DT0H0M0S**
+test_bug_49081_negative__20: DIFF: 2010-01-31 00:00:00 EST - 2010-03-01 00:00:00 EST = **P-0Y1M1DT0H0M0S**
+test_bug_49081_negative__21: DIFF: 2010-01-31 00:00:00 EST - 2010-03-27 00:00:00 EDT = **P-0Y1M27DT0H0M0S**
+test_bug_49081_negative__22: DIFF: 2010-01-31 00:00:00 EST - 2010-03-28 00:00:00 EDT = **P-0Y1M28DT0H0M0S**
+test_bug_49081_negative__23: DIFF: 2010-01-31 00:00:00 EST - 2010-03-29 00:00:00 EDT = **P-0Y1M29DT0H0M0S**
+test_bug_49081_negative__24: DIFF: 2010-01-31 00:00:00 EST - 2010-03-30 00:00:00 EDT = **P-0Y1M30DT0H0M0S**
+test_bug_49081_negative__25: DIFF: 2010-01-31 00:00:00 EST - 2010-03-31 00:00:00 EDT = **P-0Y2M0DT0H0M0S**
+test_bug_49081_negative__26: DIFF: 2010-01-30 00:00:00 EST - 2010-03-31 00:00:00 EDT = **P-0Y2M1DT0H0M0S**
+test_bug_49081_negative__27: DIFF: 2009-01-01 00:00:00 EST - 2009-01-31 00:00:00 EST = **P-0Y0M30DT0H0M0S**
+test_bug_49081_negative__28: DIFF: 2010-02-28 00:00:00 EST - 2010-03-27 00:00:00 EDT = **P-0Y0M27DT0H0M0S**
+test_bug_49081_negative__29: DIFF: 2010-02-28 00:00:00 EST - 2010-03-28 00:00:00 EDT = **P-0Y1M0DT0H0M0S**
+test_bug_49081_negative__30: DIFF: 2010-02-28 00:00:00 EST - 2010-03-29 00:00:00 EDT = **P-0Y1M1DT0H0M0S**
+test_bug_49081_negative__31: DIFF: 2010-02-27 00:00:00 EST - 2010-03-27 00:00:00 EDT = **P-0Y1M0DT0H0M0S**
+test_bug_49081_negative__32: DIFF: 2010-02-26 00:00:00 EST - 2010-03-27 00:00:00 EDT = **P-0Y1M1DT0H0M0S**
diff --git a/ext/date/tests/DateTime_diff-massive.phpt b/ext/date/tests/DateTime_diff-massive.phpt
new file mode 100644
index 0000000..2199f84
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-massive.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DateTime::diff() -- massive
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-massive.inc';
+
+?>
+--EXPECT--
+test_massive_positive: DIFF: 333333-01-01 16:18:02 EST - -333333-01-01 16:18:02 EST = **P+666666Y0M0DT0H0M0S**
+test_massive_negative: DIFF: -333333-01-01 16:18:02 EST - 333333-01-01 16:18:02 EST = **P-666666Y0M0DT0H0M0S**
diff --git a/ext/date/tests/DateTime_diff-spring-type2-type2.phpt b/ext/date/tests/DateTime_diff-spring-type2-type2.phpt
new file mode 100644
index 0000000..730cfd1
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-spring-type2-type2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DateTime::diff() -- spring type2 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-spring-type2-type2.inc';
+
+?>
+--EXPECT--
+test_time_spring_type2_prev_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-02-11 02:18:48 EST = **P+0Y1M2DT16H19M40S**
+test_time_spring_type2_prev_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-13 18:38:28 EST = **P+0Y0M0DT5H31M52S**
+test_time_spring_type2_prev_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M0DT7H38M27S**
+test_time_spring_type2_prev_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M2DT0H21M31S**
+test_time_spring_type2_st_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 00:10:20 EST = **P-0Y0M0DT5H31M52S**
+test_time_spring_type2_st_type2_st: DIFF: 2010-03-14 00:15:35 EST - 2010-03-14 00:10:20 EST = **P+0Y0M0DT0H5M15S**
+test_time_spring_type2_st_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M0DT2H6M35S**
+test_time_spring_type2_st_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M1DT18H49M39S**
+test_time_spring_type2_dt_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT7H38M27S**
+test_time_spring_type2_dt_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT2H6M35S**
+test_time_spring_type2_dt_type2_dt: DIFF: 2010-03-14 05:19:56 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M0DT2H3M1S**
+test_time_spring_type2_dt_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M1DT16H43M4S**
+test_time_spring_type2_post_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M2DT0H21M31S**
+test_time_spring_type2_post_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT18H49M39S**
+test_time_spring_type2_post_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT16H43M4S**
+test_time_spring_type2_post_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-15 18:57:55 EDT = **P+0Y0M0DT1H2M4S**
+test_time_spring_type2_stsec_type2_dtsec: DIFF: 2010-03-14 03:00:00 EDT - 2010-03-14 01:59:59 EST = **P+0Y0M0DT0H0M1S**
+test_time_spring_type2_dtsec_type2_stsec: DIFF: 2010-03-14 01:59:59 EST - 2010-03-14 03:00:00 EDT = **P-0Y0M0DT0H0M1S**
diff --git a/ext/date/tests/DateTime_diff-spring-type2-type3.phpt b/ext/date/tests/DateTime_diff-spring-type2-type3.phpt
new file mode 100644
index 0000000..98dcf79
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-spring-type2-type3.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::diff() -- spring type2 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-spring-type2-type3.inc';
+
+?>
+--EXPECT--
+test_time_spring_type2_prev_type3_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-02-11 02:18:48 EST = **P+0Y1M2DT16H19M40S**
+test_time_spring_type2_prev_type3_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-13 18:38:28 EST = **P+0Y0M0DT5H31M52S**
+test_time_spring_type2_prev_type3_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M0DT7H38M27S**
+test_time_spring_type2_prev_type3_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M2DT1H21M31S**
+test_time_spring_type2_st_type3_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 00:10:20 EST = **P-0Y0M0DT5H31M52S**
+test_time_spring_type2_st_type3_st: DIFF: 2010-03-14 00:15:35 EST - 2010-03-14 00:10:20 EST = **P+0Y0M0DT0H5M15S**
+test_time_spring_type2_st_type3_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M0DT2H6M35S**
+test_time_spring_type2_st_type3_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M1DT18H49M39S**
+test_time_spring_type2_dt_type3_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT7H38M27S**
+test_time_spring_type2_dt_type3_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT2H6M35S**
+test_time_spring_type2_dt_type3_dt: DIFF: 2010-03-14 05:19:56 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M0DT2H3M1S**
+test_time_spring_type2_dt_type3_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M1DT16H43M4S**
+test_time_spring_type2_post_type3_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M2DT1H21M31S**
+test_time_spring_type2_post_type3_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT18H49M39S**
+test_time_spring_type2_post_type3_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT16H43M4S**
+test_time_spring_type2_post_type3_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-15 18:57:55 EDT = **P+0Y0M0DT1H2M4S**
+test_time_spring_type2_stsec_type3_dtsec: DIFF: 2010-03-15 03:00:00 EDT - 2010-03-13 01:59:59 EST = **P+0Y0M0DT0H0M1S**
+test_time_spring_type2_dtsec_type3_stsec: DIFF: 2010-03-15 01:59:59 EST - 2010-03-15 03:00:00 EDT = **P-0Y0M0DT0H0M1S**
diff --git a/ext/date/tests/DateTime_diff-spring-type3-type2.phpt b/ext/date/tests/DateTime_diff-spring-type3-type2.phpt
new file mode 100644
index 0000000..5a59f78
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-spring-type3-type2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::diff() -- spring type3 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-spring-type3-type2.inc';
+
+?>
+--EXPECT--
+test_time_spring_type3_prev_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-02-11 02:18:48 EST = **P+0Y1M2DT16H19M40S**
+test_time_spring_type3_prev_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-13 18:38:28 EST = **P+0Y0M0DT5H31M52S**
+test_time_spring_type3_prev_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M0DT7H38M27S**
+test_time_spring_type3_prev_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M2DT1H21M31S**
+test_time_spring_type3_st_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 00:10:20 EST = **P-0Y0M0DT5H31M52S**
+test_time_spring_type3_st_type2_st: DIFF: 2010-03-14 00:15:35 EST - 2010-03-14 00:10:20 EST = **P+0Y0M0DT0H5M15S**
+test_time_spring_type3_st_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M0DT2H6M35S**
+test_time_spring_type3_st_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M1DT18H49M39S**
+test_time_spring_type3_dt_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT7H38M27S**
+test_time_spring_type3_dt_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT2H6M35S**
+test_time_spring_type3_dt_type2_dt: DIFF: 2010-03-14 05:19:56 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M0DT2H3M1S**
+test_time_spring_type3_dt_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M1DT16H43M4S**
+test_time_spring_type3_post_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M2DT1H21M31S**
+test_time_spring_type3_post_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT18H49M39S**
+test_time_spring_type3_post_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT16H43M4S**
+test_time_spring_type3_post_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-15 18:57:55 EDT = **P+0Y0M0DT1H2M4S**
+test_time_spring_type3_stsec_type2_dtsec: DIFF: 2010-03-15 03:00:00 EDT - 2010-03-13 01:59:59 EST = **P+0Y0M0DT0H0M1S**
+test_time_spring_type3_dtsec_type2_stsec: DIFF: 2010-03-15 01:59:59 EST - 2010-03-15 03:00:00 EDT = **P-0Y0M0DT0H0M1S**
diff --git a/ext/date/tests/DateTime_diff-spring-type3-type3.phpt b/ext/date/tests/DateTime_diff-spring-type3-type3.phpt
new file mode 100644
index 0000000..926f299
--- /dev/null
+++ b/ext/date/tests/DateTime_diff-spring-type3-type3.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::diff() -- spring type3 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
+require 'DateTime_data-spring-type3-type3.inc'
+
+?>
+--EXPECT--
+test_time_spring_type3_prev_type3_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-02-11 02:18:48 EST = **P+0Y1M2DT16H19M40S**
+test_time_spring_type3_prev_type3_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-13 18:38:28 EST = **P+0Y0M0DT5H31M52S**
+test_time_spring_type3_prev_type3_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M0DT7H38M27S**
+test_time_spring_type3_prev_type3_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M2DT1H21M31S**
+test_time_spring_type3_st_type3_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 00:10:20 EST = **P-0Y0M0DT5H31M52S**
+test_time_spring_type3_st_type3_st: DIFF: 2010-03-14 00:15:35 EST - 2010-03-14 00:10:20 EST = **P+0Y0M0DT0H5M15S**
+test_time_spring_type3_st_type3_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M0DT2H6M35S**
+test_time_spring_type3_st_type3_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M1DT18H49M39S**
+test_time_spring_type3_dt_type3_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT7H38M27S**
+test_time_spring_type3_dt_type3_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT2H6M35S**
+test_time_spring_type3_dt_type3_dt: DIFF: 2010-03-14 05:19:56 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M0DT2H3M1S**
+test_time_spring_type3_dt_type3_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M1DT16H43M4S**
+test_time_spring_type3_post_type3_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M2DT1H21M31S**
+test_time_spring_type3_post_type3_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT18H49M39S**
+test_time_spring_type3_post_type3_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT16H43M4S**
+test_time_spring_type3_post_type3_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-15 18:57:55 EDT = **P+0Y0M0DT1H2M4S**
+test_time_spring_type3_stsec_type2_dtsec: DIFF: 2010-03-15 03:00:00 EDT - 2010-03-13 01:59:59 EST = **P+0Y0M0DT0H0M1S**
+test_time_spring_type3_dtsec_type2_stsec: DIFF: 2010-03-15 01:59:59 EST - 2010-03-15 03:00:00 EDT = **P-0Y0M0DT0H0M1S**
diff --git a/ext/date/tests/DateTime_extends_basic1.phpt b/ext/date/tests/DateTime_extends_basic1.phpt
new file mode 100644
index 0000000..8fe53d6
--- /dev/null
+++ b/ext/date/tests/DateTime_extends_basic1.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test DateTime class inheritance
+--FILE--
+<?php
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing basic DateTime inheritance() ***\n";
+
+
+class DateTimeExt extends DateTime
+{
+ public static $format = "F j, Y, g:i:s a";
+
+ public function __toString()
+ {
+ return parent::format(self::$format);
+ }
+}
+
+echo "\n-- Create an instance of DateTimeExt --\n";
+$d = new DateTimeExt("1967-05-01 22:30:41");
+
+echo "\n-- Invoke __toString --\n";
+echo $d . "\n";
+
+echo "\n -- modify date and time --\n";
+$d->setDate(1963, 7, 2);
+$d->setTime(10, 45, 30);
+
+echo "\n-- Invoke __toString again --\n";
+echo $d . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing basic DateTime inheritance() ***
+
+-- Create an instance of DateTimeExt --
+
+-- Invoke __toString --
+May 1, 1967, 10:30:41 pm
+
+ -- modify date and time --
+
+-- Invoke __toString again --
+July 2, 1963, 10:45:30 am
+===DONE===
diff --git a/ext/date/tests/DateTime_extends_basic2.phpt b/ext/date/tests/DateTime_extends_basic2.phpt
new file mode 100644
index 0000000..a4bf4aa
--- /dev/null
+++ b/ext/date/tests/DateTime_extends_basic2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test DateTime class inheritance : with user space __construct magic method
+--FILE--
+<?php
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing new DateTime() : with user space __construct magic method ***\n";
+
+class DateTimeExt extends DateTime
+{
+ public function __construct ($date = null, DateTimeZone $dtz = null)
+ {
+ if($dtz === null)
+ {
+ $dtz = new DateTimeZone(date_default_timezone_get());
+ }
+ parent::__construct($date, $dtz);
+ }
+}
+
+$d = new DateTimeExt("1967-05-01 22:30:41");
+echo $d->format("F j, Y, g:i:s a") . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing new DateTime() : with user space __construct magic method ***
+May 1, 1967, 10:30:41 pm
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTime_extends_basic3.phpt b/ext/date/tests/DateTime_extends_basic3.phpt
new file mode 100644
index 0000000..bee395a
--- /dev/null
+++ b/ext/date/tests/DateTime_extends_basic3.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test DateTime class inheritance : with user space fromat() method
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing new DateTime() : with user format() method ***\n";
+
+class DateTimeExt extends DateTime
+{
+ public function format($format = "F j, Y, g:i:s a")
+ {
+ return parent::format($format);
+ }
+}
+
+$d = new DateTimeExt("1967-05-01 22:30:41");
+echo $d->format() . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing new DateTime() : with user format() method ***
+May 1, 1967, 10:30:41 pm
+===DONE===
diff --git a/ext/date/tests/DateTime_format_basic1.phpt b/ext/date/tests/DateTime_format_basic1.phpt
new file mode 100644
index 0000000..b5bbecf
--- /dev/null
+++ b/ext/date/tests/DateTime_format_basic1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test DateTime::format() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public string DateTime::format ( string $format )
+ * Description: Returns date formatted according to given format
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_format
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::format() : basic functionality ***\n";
+$date = new DateTime("2005-07-14 22:30:41");
+
+var_dump( $date->format( "F j, Y, g:i a") );
+var_dump( $date->format( "m.d.y") );
+var_dump( $date->format( "j, n, Y") );
+var_dump( $date->format( "Ymd") );
+var_dump( $date->format( 'h-i-s, j-m-y, it is w Day') );
+var_dump( $date->format( '\i\t \i\s \t\h\e jS \d\a\y.') );
+var_dump( $date->format( "D M j G:i:s T Y") );
+var_dump( $date->format( 'H:m:s \m \i\s\ \m\o\n\t\h') );
+var_dump( $date->format( "H:i:s") );
+
+?>
+===DONE===
+--EXPECT--
+*** Testing DateTime::format() : basic functionality ***
+string(23) "July 14, 2005, 10:30 pm"
+string(8) "07.14.05"
+string(11) "14, 7, 2005"
+string(8) "20050714"
+string(39) "10-30-41, 14-07-05, 3031 3041 4 Thupm05"
+string(19) "it is the 14th day."
+string(28) "Thu Jul 14 22:30:41 BST 2005"
+string(19) "22:07:41 m is month"
+string(8) "22:30:41"
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTime_format_basic2.phpt b/ext/date/tests/DateTime_format_basic2.phpt
new file mode 100644
index 0000000..d7adaa5
--- /dev/null
+++ b/ext/date/tests/DateTime_format_basic2.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test date_format() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public string DateTime::format ( string $format )
+ * Description: Returns date formatted according to given format
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_format
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_format() : basic functionality - formatting coinstants ***\n";
+$date = new DateTime("2005-07-14 22:30:41");
+
+var_dump( $date->format( DateTime::ATOM) ) ;
+var_dump( $date->format( DateTime::COOKIE) ) ;
+var_dump( $date->format( DateTime::ISO8601) ) ;
+var_dump( $date->format( DateTime::RFC822) ) ;
+var_dump( $date->format( DateTime::RFC850) ) ;
+var_dump( $date->format( DateTime::RFC1036) ) ;
+var_dump( $date->format( DateTime::RFC1123) ) ;
+var_dump( $date->format( DateTime:: RFC2822) ) ;
+var_dump( $date->format( DateTime::RFC3339) ) ;
+var_dump( $date->format( DateTime::RSS) ) ;
+var_dump( $date->format( DateTime::W3C) ) ;
+
+?>
+===DONE===
+--EXPECT--
+*** Testing date_format() : basic functionality - formatting coinstants ***
+string(25) "2005-07-14T22:30:41+01:00"
+string(32) "Thursday, 14-Jul-05 22:30:41 BST"
+string(24) "2005-07-14T22:30:41+0100"
+string(29) "Thu, 14 Jul 05 22:30:41 +0100"
+string(32) "Thursday, 14-Jul-05 22:30:41 BST"
+string(29) "Thu, 14 Jul 05 22:30:41 +0100"
+string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
+string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
+string(25) "2005-07-14T22:30:41+01:00"
+string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
+string(25) "2005-07-14T22:30:41+01:00"
+===DONE===
diff --git a/ext/date/tests/DateTime_format_error.phpt b/ext/date/tests/DateTime_format_error.phpt
new file mode 100644
index 0000000..db1be92
--- /dev/null
+++ b/ext/date/tests/DateTime_format_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test DateTime::format() function : error conditions
+--FILE--
+<?php
+/* Prototype : public string DateTime::format ( string $format )
+ * Description: Returns date formatted according to given format
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_format
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+// Craete a date object
+$date = new DateTime("2005-07-14 22:30:41");
+
+echo "*** Testing DateTime::format() : error conditions ***\n";
+
+echo "\n-- Testing date_date_formatcreate() function with zero arguments --\n";
+var_dump( $date->format() );
+
+echo "\n-- Testing date_date_formatcreate() function with more than expected no. of arguments --\n";
+$format = "F j, Y, g:i a";
+$extra_arg = 10;
+var_dump( $date->format($format, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::format() : error conditions ***
+
+-- Testing date_date_formatcreate() function with zero arguments --
+
+Warning: DateTime::format() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_date_formatcreate() function with more than expected no. of arguments --
+
+Warning: DateTime::format() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_format_variation1.phpt b/ext/date/tests/DateTime_format_variation1.phpt
new file mode 100644
index 0000000..87a9922
--- /dev/null
+++ b/ext/date/tests/DateTime_format_variation1.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test DateTime::format() function : usage variation - Passing unexpected values to first argument $format.
+--FILE--
+<?php
+/* Prototype : public string DateTime::format ( string $format )
+ * Description: Returns date formatted according to given format
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_format
+ */
+
+echo "*** Testing DateTime::format() : usage variation - unexpected values to first argument \$format***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2005-07-14 22:30:41");
+
+foreach($inputs as $variation =>$format) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->format($format) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::format() : usage variation - unexpected values to first argument $format***
+
+-- int 0 --
+string(1) "0"
+
+-- int 1 --
+string(1) "1"
+
+-- int 12345 --
+string(5) "12345"
+
+-- int -12345 --
+string(6) "-12345"
+
+-- float 10.5 --
+string(4) "10.5"
+
+-- float -10.5 --
+string(5) "-10.5"
+
+-- float .5 --
+string(3) "0.5"
+
+-- empty array --
+
+Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+string(0) ""
+
+-- lowercase null --
+string(0) ""
+
+-- lowercase true --
+string(1) "1"
+
+-- lowercase false --
+string(0) ""
+
+-- uppercase TRUE --
+string(1) "1"
+
+-- uppercase FALSE --
+string(0) ""
+
+-- empty string DQ --
+string(0) ""
+
+-- empty string SQ --
+string(0) ""
+
+-- string DQ --
+string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710"
+
+-- string SQ --
+string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710"
+
+-- mixed case string --
+string(40) "41BSTThu, 14 Jul 2005 22:30:41 +01001722"
+
+-- heredoc --
+string(82) "10Europe/LondonThursdayThursday2005 42005Thu, 14 Jul 2005 22:30:41 +0100Thursday14"
+
+-- instance of classWithToString --
+string(66) "CThursdaypm4141 PM 2005b14Europe/London2005-07-14T22:30:41+01:0031"
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::format() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+string(0) ""
+
+-- unset var --
+string(0) ""
+
+-- resource --
+
+Warning: DateTime::format() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_getOffset_basic1.phpt b/ext/date/tests/DateTime_getOffset_basic1.phpt
new file mode 100644
index 0000000..41b1a78
--- /dev/null
+++ b/ext/date/tests/DateTime_getOffset_basic1.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test DateTime::getOffset() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public int DateTime::getOffset ( void )
+ * Description: Returns the daylight saving time offset
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_offset_get
+ */
+
+//Set the default time zone
+date_default_timezone_set('Europe/London');
+
+echo "*** Testing DateTime::getOffset() : basic functionality ***\n";
+
+$winter = new DateTime('2008-12-25 14:25:41');
+$summer = new DateTime('2008-07-02 14:25:41');
+
+echo "Winter offset: " . $winter->getOffset() / 3600 . " hours\n";
+echo "Summer offset: " . $summer->getOffset() / 3600 . " hours\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::getOffset() : basic functionality ***
+Winter offset: 0 hours
+Summer offset: 1 hours
+===DONE===
diff --git a/ext/date/tests/DateTime_getOffset_error.phpt b/ext/date/tests/DateTime_getOffset_error.phpt
new file mode 100644
index 0000000..6e9c3f4
--- /dev/null
+++ b/ext/date/tests/DateTime_getOffset_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test DateTime::getOffset() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : public int DateTime::getOffset ( void )
+ * Description: Returns the daylight saving time offset
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_offset_get
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::getOffset() : error conditions ***\n";
+
+echo "\n-- Testing DateTime::getOffset() function with more than expected no. of arguments --\n";
+$datetime = new DateTime("2009-01-30 19:34:10");
+$extra_arg = 30;
+
+var_dump( $datetime->getOffset($extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::getOffset() : error conditions ***
+
+-- Testing DateTime::getOffset() function with more than expected no. of arguments --
+
+Warning: DateTime::getOffset() expects exactly 0 parameters, 1 given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/DateTime_getTimeZone_basic1.phpt b/ext/date/tests/DateTime_getTimeZone_basic1.phpt
new file mode 100644
index 0000000..ee8a0db
--- /dev/null
+++ b/ext/date/tests/DateTime_getTimeZone_basic1.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test DateTime::getTimezone() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public DateTimeZone DateTime::getTimezone ( void )
+ * Description: Return time zone relative to given DateTime
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_timezone_get
+ */
+
+echo "*** Testing DateTime::getTimezone() : basic functionality ***\n";
+
+date_default_timezone_set("Europe/London");
+$object = new DateTime("2009-01-30 17:57:32");
+var_dump( $object->getTimeZone()->getName() );
+
+
+date_default_timezone_set("America/New_York");
+$object = new DateTime("2009-01-30 17:57:32");
+var_dump( $object->getTimeZone()->getName() );
+
+$la_time = new DateTimeZone("America/Los_Angeles");
+$object->setTimeZone($la_time);
+var_dump( $object->getTimeZone()->getName() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::getTimezone() : basic functionality ***
+string(13) "Europe/London"
+string(16) "America/New_York"
+string(19) "America/Los_Angeles"
+===DONE===
diff --git a/ext/date/tests/DateTime_modify_basic1.phpt b/ext/date/tests/DateTime_modify_basic1.phpt
new file mode 100644
index 0000000..052524d
--- /dev/null
+++ b/ext/date/tests/DateTime_modify_basic1.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test DateTime::modify() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::modify ( string $modify )
+ * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
+ * Source code: ext/date/php_date.c
+ * Alias to functions: public date_modify()
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::modify() : basic functionality ***\n";
+
+// Create a date object to modify
+$datetime = new DateTime("2009-01-31 14:28:41");
+
+$datetime->modify("+1 day");
+echo "After modification 1: " . $datetime->format("D, d M Y") . "\n";
+
+$datetime->modify("+1 week 2 days 4 hours 2 seconds");
+echo "After modification 2: " . $datetime->format("D, d M Y H:i:s") . "\n";
+
+$datetime->modify("next Thursday");
+echo "After modification 3: " . $datetime->format("D, d M Y") . "\n";
+
+$datetime->modify("last Sunday");
+echo "After modification 4: " . $datetime->format("D, d M Y") . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::modify() : basic functionality ***
+After modification 1: Sun, 01 Feb 2009
+After modification 2: Tue, 10 Feb 2009 18:28:43
+After modification 3: Thu, 12 Feb 2009
+After modification 4: Sun, 08 Feb 2009
+===DONE===
diff --git a/ext/date/tests/DateTime_modify_error.phpt b/ext/date/tests/DateTime_modify_error.phpt
new file mode 100644
index 0000000..bc4f242
--- /dev/null
+++ b/ext/date/tests/DateTime_modify_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test DateTime::modify() function : error conditions
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::modify ( string $modify )
+ * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
+ * Source code: ext/date/php_date.c
+ * Alias to functions: public date_modify()
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::modify() : error conditions ***\n";
+
+// Create a date object
+$object = new DateTime("2009-01-30 19:34:10");
+
+echo "\n-- Testing DateTime::modify() function with less than expected no. of arguments --\n";
+var_dump( $object->modify() );
+
+echo "\n-- Testing DateTime::modify() function with more than expected no. of arguments --\n";
+$modify = "+1 day";
+$extra_arg = 99;
+var_dump( $object->modify($modify, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::modify() : error conditions ***
+
+-- Testing DateTime::modify() function with less than expected no. of arguments --
+
+Warning: DateTime::modify() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing DateTime::modify() function with more than expected no. of arguments --
+
+Warning: DateTime::modify() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/DateTime_modify_variation1.phpt b/ext/date/tests/DateTime_modify_variation1.phpt
new file mode 100644
index 0000000..faeb70c
--- /dev/null
+++ b/ext/date/tests/DateTime_modify_variation1.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test DateTime::modify() function : usage variation - Passing unexpected values to first argument $modify.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::modify ( string $modify )
+ * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
+ * Source code: ext/date/php_date.c
+ * Alias to functions: public date_modify()
+ */
+
+echo "*** Testing DateTime::modify() : usage variation - unexpected values to first argument \$modify***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-01-31 14:28:41");
+
+foreach($inputs as $variation =>$format) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->modify($format) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::modify() : usage variation - unexpected values to first argument $modify***
+
+-- int 0 --
+
+Warning: DateTime::modify(): Failed to parse time string (0) at position 0 (0): Unexpected character in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- int 1 --
+
+Warning: DateTime::modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- int 12345 --
+
+Warning: DateTime::modify(): Failed to parse time string (12345) at position 4 (5): Unexpected character in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- int -12345 --
+
+Warning: DateTime::modify(): Failed to parse time string (-12345) at position 5 (5): Unexpected character in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- float 10.5 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:05:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+
+Warning: DateTime::modify(): Failed to parse time string (-10.5) at position 4 (5): Unexpected character in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- float .5 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-01-31 00:05:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::modify() expects parameter 1 to be string, array given in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::modify() expects parameter 1 to be string, array given in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::modify() expects parameter 1 to be string, array given in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::modify() expects parameter 1 to be string, array given in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- uppercase NULL --
+
+Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- lowercase null --
+
+Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- lowercase true --
+
+Warning: DateTime::modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- lowercase false --
+
+Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: DateTime::modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- empty string DQ --
+
+Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::modify(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::modify(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::modify(): Failed to parse time string (sTrInG) at position 0 (s): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::modify(): Failed to parse time string (hello world) at position 0 (h): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::modify(): Failed to parse time string (Class A object) at position 0 (C): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::modify() expects parameter 1 to be string, object given in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- undefined var --
+
+Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- unset var --
+
+Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99
+bool(false)
+
+-- resource --
+
+Warning: DateTime::modify() expects parameter 1 to be string, resource given in %sDateTime_modify_variation1.php on line 99
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_serialize.phpt b/ext/date/tests/DateTime_serialize.phpt
new file mode 100644
index 0000000..ff82736
--- /dev/null
+++ b/ext/date/tests/DateTime_serialize.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test serialization of DateTime objects
+--FILE--
+<?php
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+$date1 = new DateTime("2005-07-14 22:30:41");
+var_dump($date1);
+$serialized = serialize($date1);
+var_dump($serialized);
+
+$date2 = unserialize($serialized);
+var_dump($date2);
+// Try to use unserialzied object
+var_dump( $date2->format( "F j, Y, g:i a") );
+
+?>
+===DONE===
+--EXPECTF--
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+string(118) "O:8:"DateTime":3:{s:4:"date";s:19:"2005-07-14 22:30:41";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/London";}"
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+string(23) "July 14, 2005, 10:30 pm"
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTime_setDate_basic1.phpt b/ext/date/tests/DateTime_setDate_basic1.phpt
new file mode 100644
index 0000000..7989470
--- /dev/null
+++ b/ext/date/tests/DateTime_setDate_basic1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test DateTime::setDate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_date_set()
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::setDate() : basic functionality ***\n";
+
+$datetime = new DateTime("2009-01-30 19:34:10");
+
+echo $datetime->format(DATE_RFC2822) . "\n";
+
+$datetime->setDate(2008, 02, 01);
+
+echo $datetime->format(DATE_RFC2822) . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setDate() : basic functionality ***
+Fri, 30 Jan 2009 19:34:10 +0000
+Fri, 01 Feb 2008 19:34:10 +0000
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTime_setDate_error.phpt b/ext/date/tests/DateTime_setDate_error.phpt
new file mode 100644
index 0000000..29c019a
--- /dev/null
+++ b/ext/date/tests/DateTime_setDate_error.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test DateTime::setDate() function : error conditions
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_date_set()
+ */
+
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::setDate() : error conditions ***\n";
+
+$datetime = new DateTime("2009-01-30 19:34:10");
+
+echo "\n-- Testing DateTime::setDate() function with zero arguments --\n";
+var_dump( $datetime->setDate() );
+
+echo "\n-- Testing DateTime::setDate() function with less than expected no. of arguments --\n";
+$year = 2009;
+$month = 1;
+$day = 30;
+var_dump( $datetime->setDate($year) );
+var_dump( $datetime->setDate($year, $month) );
+
+echo "\n-- Testing DateTime::setDate() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( $datetime->setDate($year, $month, $day, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setDate() : error conditions ***
+
+-- Testing DateTime::setDate() function with zero arguments --
+
+Warning: DateTime::setDate() expects exactly 3 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing DateTime::setDate() function with less than expected no. of arguments --
+
+Warning: DateTime::setDate() expects exactly 3 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: DateTime::setDate() expects exactly 3 parameters, 2 given in %s on line %d
+bool(false)
+
+-- Testing DateTime::setDate() function with more than expected no. of arguments --
+
+Warning: DateTime::setDate() expects exactly 3 parameters, 4 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setDate_variation1.phpt b/ext/date/tests/DateTime_setDate_variation1.phpt
new file mode 100644
index 0000000..5017cc1
--- /dev/null
+++ b/ext/date/tests/DateTime_setDate_variation1.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setDate() function : usage variation - Passing unexpected values to first argument $year.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_date_set
+ */
+
+echo "*** Testing DateTime::setDate() : usage variation - unexpected values to first argument \$year***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-02-27 08:34:10");
+$day = 2;
+$month = 7;
+
+foreach($inputs as $variation =>$year) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setDate($year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setDate() : usage variation - unexpected values to first argument $year***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(20) "12345-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(21) "-12345-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0010-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(20) "-0010-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setDate() expects parameter 1 to be long, resource given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/DateTime_setDate_variation2.phpt b/ext/date/tests/DateTime_setDate_variation2.phpt
new file mode 100644
index 0000000..a853f5e
--- /dev/null
+++ b/ext/date/tests/DateTime_setDate_variation2.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setDate() function : usage variation - Passing unexpected values to second argument $month.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_date_set
+ */
+
+echo "*** Testing DateTime::setDate() : usage variation - unexpected values to second argument \$month***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-02-27 08:34:10");
+$day = 2;
+$year = 1963;
+
+foreach($inputs as $variation =>$month) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setDate($year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setDate() : usage variation - unexpected values to second argument $month***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2991-09-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0934-03-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-10-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-02-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setDate() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setDate_variation3.phpt b/ext/date/tests/DateTime_setDate_variation3.phpt
new file mode 100644
index 0000000..da98e59
--- /dev/null
+++ b/ext/date/tests/DateTime_setDate_variation3.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setDate() function : usage variation - Passing unexpected values to third argument $day.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_date_set
+ */
+
+echo "*** Testing DateTime::setDate() : usage variation - unexpected values to third argument \$day***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-02-27 08:34:10");
+$month = 7;
+$year = 1963;
+
+foreach($inputs as $variation =>$day) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setDate($year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setDate() : usage variation - unexpected values to third argument $day***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-07-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1997-04-17 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1929-09-11 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-07-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-20 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-07-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-07-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setDate() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setISODate_basic1.phpt b/ext/date/tests/DateTime_setISODate_basic1.phpt
new file mode 100644
index 0000000..cdedb44
--- /dev/null
+++ b/ext/date/tests/DateTime_setISODate_basic1.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test DateTime::setISODate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_isodate_set
+ */
+
+echo "*** Testing DateTime::setISODate() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+// Create a deate object
+$datetime = new DateTime("2009-01-30 17:57:32");
+
+// Which month is week 40 ?
+$datetime->setISODate(2008, 40);
+echo "Week 40 of 2009 is in \"" . $datetime->format("F") . "\"\n";
+
+// What date is week week 30 day 3 ?
+$datetime->setISODate(2009, 30, 3);
+echo "Week 30 day 3 of 2009 is \"" . $datetime->format("D M j") . "\"\n";
+
+// What date was is last year ?
+$datetime->setISODate(2008, 30, 3);
+echo "..same day last year was \"" . $datetime->format("D M j") . "\"\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setISODate() : basic functionality ***
+Week 40 of 2009 is in "September"
+Week 30 day 3 of 2009 is "Wed Jul 22"
+..same day last year was "Wed Jul 23"
+===DONE===
diff --git a/ext/date/tests/DateTime_setISODate_error.phpt b/ext/date/tests/DateTime_setISODate_error.phpt
new file mode 100644
index 0000000..af22581
--- /dev/null
+++ b/ext/date/tests/DateTime_setISODate_error.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test DateTime::setISODate () function : error conditions
+--FILE--
+<?php
+
+/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_isodate_set
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+$datetime = new DateTime("2009-01-30 19:34:10");
+
+echo "*** Testing DateTime::setISODate () : error conditions ***\n";
+
+echo "\n-- Testing DateTime::setISODate() function with zero arguments --\n";
+var_dump( $datetime->setISODate() );
+
+$year = 2009;
+echo "\n-- Testing DateTime::setISODate() function with less than expected no. of arguments --\n";
+var_dump( $datetime->setISODate($year) );
+
+echo "\n-- Testing date_isodate_set() function with more than expected no. of arguments --\n";
+$week = 30;
+$day = 7;
+$extra_arg = 30;
+var_dump( $datetime->setISODate($year, $week, $day, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setISODate () : error conditions ***
+
+-- Testing DateTime::setISODate() function with zero arguments --
+
+Warning: DateTime::setISODate() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing DateTime::setISODate() function with less than expected no. of arguments --
+
+Warning: DateTime::setISODate() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing date_isodate_set() function with more than expected no. of arguments --
+
+Warning: DateTime::setISODate() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setISODate_variation1.phpt b/ext/date/tests/DateTime_setISODate_variation1.phpt
new file mode 100644
index 0000000..ded968f
--- /dev/null
+++ b/ext/date/tests/DateTime_setISODate_variation1.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setISODate() function : usage variation - Passing unexpected values to first argument $year.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_isodate_set
+ */
+
+echo "*** Testing DateTime::setISODate() : usage variation - unexpected values to first argument \$year***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-02-27 08:34:10");
+$day = 2;
+$month = 7;
+
+foreach($inputs as $variation =>$year) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setISODate($year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setISODate() : usage variation - unexpected values to first argument $year***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-02-13 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(20) "12345-02-13 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(21) "-12345-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0010-02-16 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(20) "-0010-02-19 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-02-13 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-02-13 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setISODate() expects parameter 1 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setISODate_variation2.phpt b/ext/date/tests/DateTime_setISODate_variation2.phpt
new file mode 100644
index 0000000..ce322d2
--- /dev/null
+++ b/ext/date/tests/DateTime_setISODate_variation2.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setISODate() function : usage variation - Passing unexpected values to second argument $week.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_isodate_set
+ */
+
+echo "*** Testing DateTime::setISODate() : usage variation - unexpected values to second argument \$week***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-02-27 08:34:10");
+$day = 2;
+$year = 1963;
+
+foreach($inputs as $variation =>$month) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setISODate($year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setISODate() : usage variation - unexpected values to second argument $week***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2199-07-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1726-05-21 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-03-05 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-10-16 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setISODate() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setISODate_variation3.phpt b/ext/date/tests/DateTime_setISODate_variation3.phpt
new file mode 100644
index 0000000..d2d5644
--- /dev/null
+++ b/ext/date/tests/DateTime_setISODate_variation3.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setISODate() function : usage variation - Passing unexpected values to third argument $day.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_isodate_set
+ */
+
+echo "*** Testing DateTime::setISODate() : usage variation - unexpected values to third argument \$day***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-02-27 08:34:10");
+$year = 1963;
+$month = 7;
+
+foreach($inputs as $variation =>$day) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setISODate($year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setISODate() : usage variation - unexpected values to third argument $day***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-11 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1996-11-28 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1929-04-24 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-20 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-31 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-11 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-11 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setISODate() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setTime_basic1.phpt b/ext/date/tests/DateTime_setTime_basic1.phpt
new file mode 100644
index 0000000..bd95fec
--- /dev/null
+++ b/ext/date/tests/DateTime_setTime_basic1.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test DateTime::setTime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_time_set
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::setTime() : basic functionality ***\n";
+
+// Create a DateTime object
+$datetime = new DateTime("2009-01-31 15:14:10");
+
+echo "Initial date: " . $datetime ->format(DATE_RFC2822) . "\n";
+
+$datetime->setTime(17, 20);
+echo "After modification1 " . $datetime ->format(DATE_RFC2822) . "\n";
+
+$datetime->setTime(19, 05, 59);
+echo "After modification2 " . $datetime ->format(DATE_RFC2822) . "\n";
+
+$datetime->setTime(24, 10);
+echo "After modification3 " . $datetime ->format(DATE_RFC2822) . "\n";
+
+$datetime->setTime(47, 35, 47);
+echo "After modification4 " . $datetime ->format(DATE_RFC2822) . "\n";
+
+$datetime->setTime(54, 25);
+echo "After modification5 " . $datetime ->format(DATE_RFC2822) . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setTime() : basic functionality ***
+Initial date: Sat, 31 Jan 2009 15:14:10 +0000
+After modification1 Sat, 31 Jan 2009 17:20:00 +0000
+After modification2 Sat, 31 Jan 2009 19:05:59 +0000
+After modification3 Sun, 01 Feb 2009 00:10:00 +0000
+After modification4 Mon, 02 Feb 2009 23:35:47 +0000
+After modification5 Wed, 04 Feb 2009 06:25:00 +0000
+===DONE===
diff --git a/ext/date/tests/DateTime_setTime_error.phpt b/ext/date/tests/DateTime_setTime_error.phpt
new file mode 100644
index 0000000..eaf1555
--- /dev/null
+++ b/ext/date/tests/DateTime_setTime_error.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test DateTime::setTime() function : error conditions
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_time_set
+ */
+
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::setTime() : error conditions ***\n";
+
+$datetime = date_create("2009-01-31 15:34:10");
+
+echo "\n-- Testing DateTime::setTime() function with zero arguments --\n";
+var_dump( $datetime->setTime() );
+
+echo "\n-- Testing DateTime::setTime() function with less than expected no. of arguments --\n";
+$hour = 18;
+var_dump( $datetime->setTime($hour) );
+
+echo "\n-- Testing DateTime::setTime() function with more than expected no. of arguments --\n";
+$min = 15;
+$sec = 30;
+$extra_arg = 10;
+var_dump( $datetime->setTime($hour, $min, $sec, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setTime() : error conditions ***
+
+-- Testing DateTime::setTime() function with zero arguments --
+
+Warning: DateTime::setTime() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing DateTime::setTime() function with less than expected no. of arguments --
+
+Warning: DateTime::setTime() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing DateTime::setTime() function with more than expected no. of arguments --
+
+Warning: DateTime::setTime() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setTime_variation1.phpt b/ext/date/tests/DateTime_setTime_variation1.phpt
new file mode 100644
index 0000000..7edbd4e
--- /dev/null
+++ b/ext/date/tests/DateTime_setTime_variation1.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setTime() function : usage variation - Passing unexpected values to first argument $hour.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_time_set
+ */
+
+echo "*** Testing DateTime::setTime() : usage variation - unexpected values to first argument \$hour***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-01-31 15:14:10");
+$minute = 13;
+$sec = 45;
+
+foreach($inputs as $variation =>$hour) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setTime($hour, $minute, $sec) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setTime() : usage variation - unexpected values to first argument $hour***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 01:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2010-06-29 09:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 15:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 14:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 01:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 01:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setTime() expects parameter 1 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setTime_variation2.phpt b/ext/date/tests/DateTime_setTime_variation2.phpt
new file mode 100644
index 0000000..300eb9c
--- /dev/null
+++ b/ext/date/tests/DateTime_setTime_variation2.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setTime() function : usage variation - Passing unexpected values to second argument $minute.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_time_set
+ */
+
+echo "*** Testing DateTime::setTime() : usage variation - unexpected values to second argument \$minute***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-01-31 15:14:10");
+$hour = 10;
+$sec = 45;
+
+foreach($inputs as $variation =>$minute) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setTime($hour, $minute, $sec) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setTime() : usage variation - unexpected values to second argument $minute***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:01:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-02-08 23:45:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 20:15:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:10:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 09:50:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:01:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:01:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setTime() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setTime_variation3.phpt b/ext/date/tests/DateTime_setTime_variation3.phpt
new file mode 100644
index 0000000..05bf4b5
--- /dev/null
+++ b/ext/date/tests/DateTime_setTime_variation3.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test DateTime::setTime() function : usage variation - Passing unexpected values to third argument $second.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_time_set
+ */
+
+echo "*** Testing DateTime::setTime() : usage variation - unexpected values to third argument \$second***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-01-31 15:14:10");
+$hour = 10;
+$minute = 13;
+
+foreach($inputs as $variation =>$sec) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setTime($hour, $minute, $sec) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setTime() : usage variation - unexpected values to third argument $second***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:01"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 13:38:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 06:47:15"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:12:50"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:01"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:01"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: DateTime::setTime() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setTimezone_basic1.phpt b/ext/date/tests/DateTime_setTimezone_basic1.phpt
new file mode 100644
index 0000000..f4f479f
--- /dev/null
+++ b/ext/date/tests/DateTime_setTimezone_basic1.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test DateTime::setTimezone() function : basic functionality
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setTimezone ( DateTimeZone $timezone )
+ * Description: Sets the time zone for the DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_timezone_set
+ */
+
+echo "*** Testing DateTime::setTimezone() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+$datetime = new DateTime("2009-01-30 17:57:32");
+echo "Default timezone: " . date_timezone_get($datetime)->getName() . "\n";
+
+$la_time = new DateTimezone("America/Los_Angeles");
+$datetime->setTimezone($la_time);
+echo "New timezone: " . date_timezone_get($datetime)->getName() . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setTimezone() : basic functionality ***
+Default timezone: Europe/London
+New timezone: America/Los_Angeles
+===DONE===
diff --git a/ext/date/tests/DateTime_setTimezone_error.phpt b/ext/date/tests/DateTime_setTimezone_error.phpt
new file mode 100644
index 0000000..32d03fb
--- /dev/null
+++ b/ext/date/tests/DateTime_setTimezone_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test DateTime::setTimezone () function : error conditions
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setTimezone ( DateTimeZone $timezone )
+ * Description: Sets the time zone for the DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_timezone_set
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing DateTime::setTimezone () : error conditions ***\n";
+
+$datetime = new DateTime("2009-01-30 17:57:32");
+
+echo "\n-- Testing DateTime::setTimezone () function with zero arguments --\n";
+var_dump( $datetime->setTimezone() );
+
+echo "\n-- Testing DateTime::setTimezone () function with more than expected no. of arguments --\n";
+$timezone = new DateTimezone("GMT");
+$extra_arg = 99;
+var_dump( $datetime->setTimezone($timezone, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setTimezone () : error conditions ***
+
+-- Testing DateTime::setTimezone () function with zero arguments --
+
+Warning: DateTime::setTimezone() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing DateTime::setTimezone () function with more than expected no. of arguments --
+
+Warning: DateTime::setTimezone() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_setTimezone_variation1.phpt b/ext/date/tests/DateTime_setTimezone_variation1.phpt
new file mode 100644
index 0000000..9ccfce0
--- /dev/null
+++ b/ext/date/tests/DateTime_setTimezone_variation1.phpt
@@ -0,0 +1,252 @@
+--TEST--
+Test DateTime::setTimezone() function : usage variation - Passing unexpected values to first argument $timezone.
+--FILE--
+<?php
+/* Prototype : public DateTime DateTime::setTimezone ( DateTimeZone $timezone )
+ * Description: Sets the time zone for the DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: date_timezone_set
+ */
+
+echo "*** Testing DateTime::setTimezone() : usage variation - unexpected values to first argument \$timezone***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTime("2009-01-30 17:57:32");
+
+foreach($inputs as $variation =>$timezone) {
+ echo "\n-- $variation --\n";
+ var_dump( $object->setTimezone($timezone) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::setTimezone() : usage variation - unexpected values to first argument $timezone***
+
+-- int 0 --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/DateTime_sub-dates.phpt b/ext/date/tests/DateTime_sub-dates.phpt
new file mode 100644
index 0000000..26f49ba
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-dates.phpt
@@ -0,0 +1,29 @@
+--TEST--
+DateTime::sub() -- dates
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-dates.inc';
+
+?>
+--EXPECT--
+test__7: SUB: 2009-01-14 00:00:00 EST - P+0Y0M7DT0H0M0S = **2009-01-07 00:00:00 EST**
+test_years_positive__7_by_0_day: SUB: 2007-02-07 00:00:00 EST - P+7Y0M0DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_positive__7_by_1_day: SUB: 2007-02-08 00:00:00 EST - P+7Y0M1DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_positive__6_shy_1_day: SUB: 2007-02-06 00:00:00 EST - P+6Y11M30DT0H0M0S = **2000-02-05 00:00:00 EST**
+test_years_positive__7_by_1_month: SUB: 2007-03-07 00:00:00 EST - P+7Y1M0DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_positive__6_shy_1_month: SUB: 2007-01-07 00:00:00 EST - P+6Y11M0DT0H0M0S = **2000-02-07 00:00:00 EST**
+test_years_positive__7_by_1_month_split_newyear: SUB: 2007-01-07 00:00:00 EST - P+7Y1M0DT0H0M0S = **1999-12-07 00:00:00 EST**
+test_years_positive__6_shy_1_month_split_newyear: SUB: 2006-12-07 00:00:00 EST - P+6Y11M0DT0H0M0S = **2000-01-07 00:00:00 EST**
+test_negative__7: SUB: 2009-01-07 00:00:00 EST - P-0Y0M7DT0H0M0S = **2009-01-14 00:00:00 EST**
+test_years_negative__7_by_0_day: SUB: 2000-02-07 00:00:00 EST - P-7Y0M0DT0H0M0S = **2007-02-07 00:00:00 EST**
+test_years_negative__7_by_1_day: SUB: 2000-02-07 00:00:00 EST - P-7Y0M1DT0H0M0S = **2007-02-08 00:00:00 EST**
+test_years_negative__6_shy_1_day: SUB: 2000-02-07 00:00:00 EST - P-6Y11M28DT0H0M0S = **2007-02-04 00:00:00 EST**
+test_years_negative__7_by_1_month: SUB: 2000-02-07 00:00:00 EST - P-7Y1M0DT0H0M0S = **2007-03-07 00:00:00 EST**
+test_years_negative__6_shy_1_month: SUB: 2000-02-07 00:00:00 EST - P-6Y11M0DT0H0M0S = **2007-01-07 00:00:00 EST**
+test_years_negative__7_by_1_month_split_newyear: SUB: 1999-12-07 00:00:00 EST - P-7Y1M0DT0H0M0S = **2007-01-07 00:00:00 EST**
+test_years_negative__6_shy_1_month_split_newyear: SUB: 2000-01-07 00:00:00 EST - P-6Y11M0DT0H0M0S = **2006-12-07 00:00:00 EST**
diff --git a/ext/date/tests/DateTime_sub-fall-type2-type2.phpt b/ext/date/tests/DateTime_sub-fall-type2-type2.phpt
new file mode 100644
index 0000000..e133b1f
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-fall-type2-type2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DateTime::sub() -- fall type2 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-fall-type2-type2.inc';
+
+?>
+--EXPECT--
+test_time_fall_type2_prev_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P+0Y1M2DT16H19M40S = **2010-10-04 02:18:48 EDT**
+test_time_fall_type2_prev_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P+0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_prev_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_prev_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT7H36M16S = **2010-11-06 17:38:28 EST**
+test_time_fall_type2_prev_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT9H38M27S = **2010-11-06 17:38:28 EST**
+test_time_fall_type2_prev_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EST**
+test_time_fall_type2_dt_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_dt_type2_dt: SUB: 2010-11-07 00:15:35 EDT - P+0Y0M0DT0H5M15S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_dt_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_dt_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT2H4M24S = **2010-11-06 23:10:20 EST**
+test_time_fall_type2_dt_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT4H6M35S = **2010-11-06 23:10:20 EST**
+test_time_fall_type2_dt_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT20H49M39S = **2010-11-06 23:10:20 EST**
+test_time_fall_type2_redodt_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redodt_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redodt_type2_redodt: SUB: 2010-11-07 01:15:35 EDT - P+0Y0M0DT0H3M2S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redodt_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT1H2M11S = **2010-11-07 00:12:33 EST**
+test_time_fall_type2_redodt_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT3H4M22S = **2010-11-07 00:12:33 EST**
+test_time_fall_type2_redodt_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT19H47M26S = **2010-11-07 00:12:33 EST**
+test_time_fall_type2_redost_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT7H36M16S = **2010-11-07 02:14:44 EDT**
+test_time_fall_type2_redost_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT2H4M24S = **2010-11-07 02:14:44 EDT**
+test_time_fall_type2_redost_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT1H2M11S = **2010-11-07 02:14:44 EDT**
+test_time_fall_type2_redost_type2_redost: SUB: 2010-11-07 01:16:54 EST - P+0Y0M0DT0H2M10S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_redost_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_redost_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_st_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT9H38M27S = **2010-11-07 04:16:55 EDT**
+test_time_fall_type2_st_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT4H6M35S = **2010-11-07 04:16:55 EDT**
+test_time_fall_type2_st_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT3H4M22S = **2010-11-07 04:16:55 EDT**
+test_time_fall_type2_st_type2_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_st_type2_st: SUB: 2010-11-07 05:19:56 EST - P+0Y0M0DT2H3M1S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_st_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_post_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EDT**
+test_time_fall_type2_post_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M1DT20H49M39S = **2010-11-08 20:59:59 EDT**
+test_time_fall_type2_post_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M1DT19H47M26S = **2010-11-08 20:59:59 EDT**
+test_time_fall_type2_post_type2_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type2_st: SUB: 2010-11-07 03:16:55 EST - P-0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M0DT1H2M4S = **2010-11-08 18:57:55 EST**
+test_time_fall_type2_dtsec_type2_stsec: SUB: 2010-11-07 01:00:00 EST - P+0Y0M0DT0H0M1S = **2010-11-07 00:59:59 EST**
+test_time_fall_type2_stsec_type2_dtsec: SUB: 2010-11-07 01:59:59 EDT - P-0Y0M0DT0H0M1S = **2010-11-07 02:00:00 EDT**
diff --git a/ext/date/tests/DateTime_sub-fall-type2-type3.phpt b/ext/date/tests/DateTime_sub-fall-type2-type3.phpt
new file mode 100644
index 0000000..6c2a9e0
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-fall-type2-type3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::sub() -- fall type2 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-fall-type2-type3.inc';
+
+?>
+--EXPECT--
+test_time_fall_type2_prev_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P+0Y1M2DT16H19M40S = **2010-10-04 02:18:48 EDT**
+test_time_fall_type2_prev_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P+0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_prev_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_prev_type3_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT7H36M16S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_prev_type3_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT9H38M27S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_prev_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type2_dt_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_dt_type3_dt: SUB: 2010-11-07 00:15:35 EDT - P+0Y0M0DT0H5M15S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_dt_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_dt_type3_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT2H4M24S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_dt_type3_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT4H6M35S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_dt_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT20H49M39S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type2_redodt_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redodt_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redodt_type3_redodt: SUB: 2010-11-07 01:15:35 EDT - P+0Y0M0DT0H3M2S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redodt_type3_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT1H2M11S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redodt_type3_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT3H4M22S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redodt_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT19H47M26S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type2_redost_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT7H36M16S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_redost_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT2H4M24S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_redost_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT1H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_redost_type3_redost: SUB: 2010-11-07 01:16:54 EST - P+0Y0M0DT0H2M10S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_redost_type3_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_redost_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
+test_time_fall_type2_st_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT9H38M27S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_st_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT4H6M35S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_st_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT3H4M22S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_st_type3_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_st_type3_st: SUB: 2010-11-07 05:19:56 EST - P+0Y0M0DT2H3M1S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_st_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
+test_time_fall_type2_post_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M1DT20H49M39S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M1DT19H47M26S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type3_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type3_st: SUB: 2010-11-07 03:16:55 EST - P-0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type2_post_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M0DT1H2M4S = **2010-11-08 18:57:55 EST**
+test_time_fall_type2_dtsec_type3_stsec: SUB: 2010-11-07 01:00:00 EST - P+0Y0M0DT0H0M1S = **2010-11-07 01:59:59 EDT**
+test_time_fall_type2_stsec_type3_dtsec: SUB: 2010-11-07 01:59:59 EDT - P-0Y0M0DT0H0M1S = **2010-11-07 01:00:00 EST**
diff --git a/ext/date/tests/DateTime_sub-fall-type3-type2.phpt b/ext/date/tests/DateTime_sub-fall-type3-type2.phpt
new file mode 100644
index 0000000..e545ea5
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-fall-type3-type2.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::sub() -- fall type3 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-fall-type3-type2.inc';
+
+?>
+--EXPECT--
+test_time_fall_type3_prev_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P+0Y1M2DT16H19M40S = **2010-10-04 02:18:48 EDT**
+test_time_fall_type3_prev_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P+0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT7H36M16S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT9H38M27S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_dt_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type2_dt: SUB: 2010-11-07 00:15:35 EDT - P+0Y0M0DT0H5M15S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT2H4M24S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT4H6M35S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT20H49M39S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_redodt_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type2_redodt: SUB: 2010-11-07 01:15:35 EDT - P+0Y0M0DT0H3M2S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT1H2M11S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT3H4M22S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT19H47M26S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redost_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT7H36M16S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT2H4M24S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT1H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type2_redost: SUB: 2010-11-07 01:16:54 EST - P+0Y0M0DT0H2M10S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_st_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT9H38M27S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT4H6M35S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT3H4M22S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type2_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type2_st: SUB: 2010-11-07 05:19:56 EST - P+0Y0M0DT2H3M1S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_post_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M1DT20H49M39S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M1DT19H47M26S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type2_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type2_st: SUB: 2010-11-07 03:16:55 EST - P-0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M0DT1H2M4S = **2010-11-08 18:57:55 EST**
+test_time_fall_type3_dtsec_type2_stsec: SUB: 2010-11-07 01:00:00 EST - P+0Y0M0DT0H0M1S = **2010-11-07 01:59:59 EDT**
+test_time_fall_type3_stsec_type2_dtsec: SUB: 2010-11-07 01:59:59 EDT - P-0Y0M0DT0H0M1S = **2010-11-07 01:00:00 EST**
diff --git a/ext/date/tests/DateTime_sub-fall-type3-type3.phpt b/ext/date/tests/DateTime_sub-fall-type3-type3.phpt
new file mode 100644
index 0000000..6448b5d
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-fall-type3-type3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+DateTime::sub() -- fall type3 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-fall-type3-type3.inc';
+
+?>
+--EXPECT--
+test_time_fall_type3_prev_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P+0Y1M2DT16H19M40S = **2010-10-04 02:18:48 EDT**
+test_time_fall_type3_prev_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P+0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type3_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT7H36M16S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type3_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT9H38M27S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_prev_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EDT**
+test_time_fall_type3_dt_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type3_dt: SUB: 2010-11-07 00:15:35 EDT - P+0Y0M0DT0H5M15S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type3_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT2H4M24S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type3_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT4H6M35S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_dt_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT20H49M39S = **2010-11-07 00:10:20 EDT**
+test_time_fall_type3_redodt_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type3_redodt: SUB: 2010-11-07 01:15:35 EDT - P+0Y0M0DT0H3M2S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type3_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT1H2M11S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type3_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT3H4M22S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redodt_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT19H47M26S = **2010-11-07 01:12:33 EDT**
+test_time_fall_type3_redost_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT7H36M16S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT2H4M24S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT1H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type3_redost: SUB: 2010-11-07 01:16:54 EST - P+0Y0M0DT0H2M10S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type3_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_redost_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
+test_time_fall_type3_st_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT9H38M27S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT4H6M35S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT3H4M22S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type3_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type3_st: SUB: 2010-11-07 05:19:56 EST - P+0Y0M0DT2H3M1S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_st_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
+test_time_fall_type3_post_type3_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type3_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M1DT20H49M39S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type3_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M1DT19H47M26S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type3_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type3_st: SUB: 2010-11-07 03:16:55 EST - P-0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
+test_time_fall_type3_post_type3_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M0DT1H2M4S = **2010-11-08 18:57:55 EST**
+test_time_fall_type3_dtsec_type3_stsec: SUB: 2010-11-07 01:00:00 EST - P+0Y0M0DT0H0M1S = **2010-11-07 01:59:59 EDT**
+test_time_fall_type3_stsec_type3_dtsec: SUB: 2010-11-07 01:59:59 EDT - P-0Y0M0DT0H0M1S = **2010-11-07 01:00:00 EST**
diff --git a/ext/date/tests/DateTime_sub-february.phpt b/ext/date/tests/DateTime_sub-february.phpt
new file mode 100644
index 0000000..23c8da4
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-february.phpt
@@ -0,0 +1,77 @@
+--TEST--
+DateTime::sub() -- february
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-february.inc';
+
+?>
+--EXPECT--
+test_bug_49081__1: SUB: 2010-03-31 00:00:00 EDT - P+0Y0M30DT0H0M0S = **2010-03-01 00:00:00 EST**
+test_bug_49081__2: SUB: 2010-04-01 00:00:00 EDT - P+0Y1M0DT0H0M0S = **2010-03-01 00:00:00 EST**
+test_bug_49081__3: SUB: 2010-04-01 00:00:00 EDT - P+0Y0M1DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081__4: SUB: 2010-04-29 00:00:00 EDT - P+0Y0M29DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081__5: SUB: 2010-04-30 00:00:00 EDT - P+0Y0M30DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081__6: SUB: 2010-04-30 00:00:00 EDT - P+0Y1M0DT0H0M0S = **2010-03-30 00:00:00 EDT**
+test_bug_49081__7: SUB: 2010-04-30 00:00:00 EDT - P+0Y1M1DT0H0M0S = **2010-03-29 00:00:00 EDT**
+test_bug_49081__8: SUB: 2010-01-29 00:00:00 EST - P+0Y0M28DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081__9: SUB: 2010-01-30 00:00:00 EST - P+0Y0M29DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081__10: SUB: 2010-01-31 00:00:00 EST - P+0Y0M30DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081__11: SUB: 2010-02-01 00:00:00 EST - P+0Y1M0DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081__12: SUB: 2010-02-01 00:00:00 EST - P+0Y0M1DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081__13: SUB: 2010-02-27 00:00:00 EST - P+0Y0M27DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081__14: SUB: 2010-02-28 00:00:00 EST - P+0Y0M28DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081__15: SUB: 2010-02-28 00:00:00 EST - P+0Y0M29DT0H0M0S = **2010-01-30 00:00:00 EST**
+test_bug_49081__16: SUB: 2010-02-28 00:00:00 EST - P+0Y0M30DT0H0M0S = **2010-01-29 00:00:00 EST**
+test_bug_49081__17: SUB: 2010-02-28 00:00:00 EST - P+0Y1M0DT0H0M0S = **2010-01-28 00:00:00 EST**
+test_bug_49081__18: SUB: 2010-02-28 00:00:00 EST - P+0Y1M1DT0H0M0S = **2010-01-27 00:00:00 EST**
+test_bug_49081__19: SUB: 2010-03-01 00:00:00 EST - P+0Y2M0DT0H0M0S = **2010-01-01 00:00:00 EST**
+test_bug_49081__20: SUB: 2010-03-01 00:00:00 EST - P+0Y0M29DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081__21: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M24DT0H0M0S = **2010-02-03 00:00:00 EST**
+test_bug_49081__22: SUB: 2010-03-28 00:00:00 EDT - P+0Y1M25DT0H0M0S = **2010-02-03 00:00:00 EST**
+test_bug_49081__23: SUB: 2010-03-29 00:00:00 EDT - P+0Y1M26DT0H0M0S = **2010-02-03 00:00:00 EST**
+test_bug_49081__24: SUB: 2010-03-30 00:00:00 EDT - P+0Y1M27DT0H0M0S = **2010-02-03 00:00:00 EST**
+test_bug_49081__25: SUB: 2010-03-31 00:00:00 EDT - P+0Y2M0DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081__26: SUB: 2010-03-31 00:00:00 EDT - P+0Y2M1DT0H0M0S = **2010-01-30 00:00:00 EST**
+test_bug_49081__27: SUB: 2009-01-31 00:00:00 EST - P+0Y0M30DT0H0M0S = **2009-01-01 00:00:00 EST**
+test_bug_49081__28: SUB: 2010-03-27 00:00:00 EDT - P+0Y0M27DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081__29: SUB: 2010-03-28 00:00:00 EDT - P+0Y1M0DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081__30: SUB: 2010-03-29 00:00:00 EDT - P+0Y1M1DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081__31: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M0DT0H0M0S = **2010-02-27 00:00:00 EST**
+test_bug_49081__32: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M1DT0H0M0S = **2010-02-26 00:00:00 EST**
+test_bug_49081_negative__1: SUB: 2010-03-01 00:00:00 EST - P-0Y0M30DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081_negative__2: SUB: 2010-03-01 00:00:00 EST - P-0Y1M0DT0H0M0S = **2010-04-01 00:00:00 EDT**
+test_bug_49081_negative__3: SUB: 2010-03-31 00:00:00 EDT - P-0Y0M1DT0H0M0S = **2010-04-01 00:00:00 EDT**
+test_bug_49081_negative__4: SUB: 2010-03-31 00:00:00 EDT - P-0Y0M29DT0H0M0S = **2010-04-29 00:00:00 EDT**
+test_bug_49081_negative__5: SUB: 2010-03-31 00:00:00 EDT - P-0Y0M30DT0H0M0S = **2010-04-30 00:00:00 EDT**
+test_bug_49081_negative__6: SUB: 2010-03-30 00:00:00 EDT - P-0Y1M0DT0H0M0S = **2010-04-30 00:00:00 EDT**
+test_bug_49081_negative__7: SUB: 2010-03-29 00:00:00 EDT - P-0Y1M1DT0H0M0S = **2010-04-30 00:00:00 EDT**
+test_bug_49081_negative__8: SUB: 2010-01-01 00:00:00 EST - P-0Y0M28DT0H0M0S = **2010-01-29 00:00:00 EST**
+test_bug_49081_negative__9: SUB: 2010-01-01 00:00:00 EST - P-0Y0M29DT0H0M0S = **2010-01-30 00:00:00 EST**
+test_bug_49081_negative__10: SUB: 2010-01-01 00:00:00 EST - P-0Y0M30DT0H0M0S = **2010-01-31 00:00:00 EST**
+test_bug_49081_negative__11: SUB: 2010-01-01 00:00:00 EST - P-0Y1M0DT0H0M0S = **2010-02-01 00:00:00 EST**
+test_bug_49081_negative__12: SUB: 2010-01-31 00:00:00 EST - P-0Y0M1DT0H0M0S = **2010-02-01 00:00:00 EST**
+test_bug_49081_negative__13: SUB: 2010-01-31 00:00:00 EST - P-0Y0M27DT0H0M0S = **2010-02-27 00:00:00 EST**
+test_bug_49081_negative__14: SUB: 2010-01-31 00:00:00 EST - P-0Y0M28DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081_negative__15: SUB: 2010-01-30 00:00:00 EST - P-0Y0M29DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081_negative__16: SUB: 2010-01-29 00:00:00 EST - P-0Y0M30DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081_negative__17: SUB: 2010-01-28 00:00:00 EST - P-0Y1M0DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081_negative__18: SUB: 2010-01-27 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-02-28 00:00:00 EST**
+test_bug_49081_negative__19: SUB: 2010-01-01 00:00:00 EST - P-0Y2M0DT0H0M0S = **2010-03-01 00:00:00 EST**
+test_bug_49081_negative__20: SUB: 2010-01-31 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-04 00:00:00 EST**
+test_bug_49081_negative__21: SUB: 2010-01-31 00:00:00 EST - P-0Y1M27DT0H0M0S = **2010-03-30 00:00:00 EDT**
+test_bug_49081_negative__22: SUB: 2010-01-31 00:00:00 EST - P-0Y1M28DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081_negative__23: SUB: 2010-01-31 00:00:00 EST - P-0Y1M29DT0H0M0S = **2010-04-01 00:00:00 EDT**
+test_bug_49081_negative__24: SUB: 2010-01-31 00:00:00 EST - P-0Y1M30DT0H0M0S = **2010-04-02 00:00:00 EDT**
+test_bug_49081_negative__25: SUB: 2010-01-31 00:00:00 EST - P-0Y2M0DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081_negative__26: SUB: 2010-01-30 00:00:00 EST - P-0Y2M1DT0H0M0S = **2010-03-31 00:00:00 EDT**
+test_bug_49081_negative__27: SUB: 2009-01-01 00:00:00 EST - P-0Y0M30DT0H0M0S = **2009-01-31 00:00:00 EST**
+test_bug_49081_negative__28: SUB: 2010-02-28 00:00:00 EST - P-0Y0M27DT0H0M0S = **2010-03-27 00:00:00 EDT**
+test_bug_49081_negative__29: SUB: 2010-02-28 00:00:00 EST - P-0Y1M0DT0H0M0S = **2010-03-28 00:00:00 EDT**
+test_bug_49081_negative__30: SUB: 2010-02-28 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-29 00:00:00 EDT**
+test_bug_49081_negative__31: SUB: 2010-02-27 00:00:00 EST - P-0Y1M0DT0H0M0S = **2010-03-27 00:00:00 EDT**
+test_bug_49081_negative__32: SUB: 2010-02-26 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-27 00:00:00 EDT**
diff --git a/ext/date/tests/DateTime_sub-massive.phpt b/ext/date/tests/DateTime_sub-massive.phpt
new file mode 100644
index 0000000..a0520ec
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-massive.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DateTime::sub() -- massive
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-massive.inc';
+
+?>
+--EXPECT--
+test_massive_positive: SUB: 333333-01-01 16:18:02 EST - P+666666Y0M0DT0H0M0S = **-333333-01-01 16:18:02 EST**
+test_massive_negative: SUB: -333333-01-01 16:18:02 EST - P-666666Y0M0DT0H0M0S = **333333-01-01 16:18:02 EST**
diff --git a/ext/date/tests/DateTime_sub-spring-type2-type2.phpt b/ext/date/tests/DateTime_sub-spring-type2-type2.phpt
new file mode 100644
index 0000000..925f141
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-spring-type2-type2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DateTime::sub() -- spring type2 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-spring-type2-type2.inc';
+
+?>
+--EXPECT--
+test_time_spring_type2_prev_type2_prev: SUB: 2010-03-13 18:38:28 EST - P+0Y1M2DT16H19M40S = **2010-02-11 02:18:48 EST**
+test_time_spring_type2_prev_type2_st: SUB: 2010-03-14 00:10:20 EST - P+0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_prev_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT7H38M27S = **2010-03-13 19:38:28 EDT**
+test_time_spring_type2_prev_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EDT**
+test_time_spring_type2_st_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_st_type2_st: SUB: 2010-03-14 00:15:35 EST - P+0Y0M0DT0H5M15S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_st_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT2H6M35S = **2010-03-14 01:10:20 EDT**
+test_time_spring_type2_st_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT18H49M39S = **2010-03-14 01:10:20 EDT**
+test_time_spring_type2_dt_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT7H38M27S = **2010-03-14 02:16:55 EST**
+test_time_spring_type2_dt_type2_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M0DT2H6M35S = **2010-03-14 02:16:55 EST**
+test_time_spring_type2_dt_type2_dt: SUB: 2010-03-14 05:19:56 EDT - P+0Y0M0DT2H3M1S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_dt_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_post_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EST**
+test_time_spring_type2_post_type2_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M1DT18H49M39S = **2010-03-15 18:59:59 EST**
+test_time_spring_type2_post_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P-0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_post_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M0DT1H2M4S = **2010-03-15 18:57:55 EDT**
+test_time_spring_type2_stsec_type2_dtsec: SUB: 2010-03-14 03:00:00 EDT - P+0Y0M0DT0H0M1S = **2010-03-14 02:59:59 EDT**
+test_time_spring_type2_dtsec_type2_stsec: SUB: 2010-03-14 01:59:59 EST - P-0Y0M0DT0H0M1S = **2010-03-14 02:00:00 EST**
diff --git a/ext/date/tests/DateTime_sub-spring-type2-type3.phpt b/ext/date/tests/DateTime_sub-spring-type2-type3.phpt
new file mode 100644
index 0000000..a5c43df
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-spring-type2-type3.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::sub() -- spring type2 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-spring-type2-type3.inc';
+
+?>
+--EXPECT--
+test_time_spring_type2_prev_type3_prev: SUB: 2010-03-13 18:38:28 EST - P+0Y1M2DT16H19M40S = **2010-02-11 02:18:48 EST**
+test_time_spring_type2_prev_type3_st: SUB: 2010-03-14 00:10:20 EST - P+0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_prev_type3_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT7H38M27S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_prev_type3_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EST**
+test_time_spring_type2_st_type3_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_st_type3_st: SUB: 2010-03-14 00:15:35 EST - P+0Y0M0DT0H5M15S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_st_type3_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT2H6M35S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_st_type3_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT18H49M39S = **2010-03-14 00:10:20 EST**
+test_time_spring_type2_dt_type3_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT7H38M27S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_dt_type3_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M0DT2H6M35S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_dt_type3_dt: SUB: 2010-03-14 05:19:56 EDT - P+0Y0M0DT2H3M1S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_dt_type3_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type2_post_type3_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_post_type3_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M1DT18H49M39S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_post_type3_dt: SUB: 2010-03-14 03:16:55 EDT - P-0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type2_post_type3_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M0DT1H2M4S = **2010-03-15 18:57:55 EDT**
+test_time_spring_type2_stsec_type3_dtsec: SUB: 2010-03-15 03:00:00 EDT - P+0Y0M0DT0H0M1S = **2010-03-13 01:59:59 EST**
+test_time_spring_type2_dtsec_type3_stsec: SUB: 2010-03-15 01:59:59 EST - P-0Y0M0DT0H0M1S = **2010-03-15 03:00:00 EDT**
diff --git a/ext/date/tests/DateTime_sub-spring-type3-type2.phpt b/ext/date/tests/DateTime_sub-spring-type3-type2.phpt
new file mode 100644
index 0000000..bcbbe25
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-spring-type3-type2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::sub() -- spring type3 type2
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-spring-type3-type2.inc';
+
+?>
+--EXPECT--
+test_time_spring_type3_prev_type2_prev: SUB: 2010-03-13 18:38:28 EST - P+0Y1M2DT16H19M40S = **2010-02-11 02:18:48 EST**
+test_time_spring_type3_prev_type2_st: SUB: 2010-03-14 00:10:20 EST - P+0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_prev_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT7H38M27S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_prev_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_st_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_st_type2_st: SUB: 2010-03-14 00:15:35 EST - P+0Y0M0DT0H5M15S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_st_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT2H6M35S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_st_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT18H49M39S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_dt_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT7H38M27S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_dt_type2_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M0DT2H6M35S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_dt_type2_dt: SUB: 2010-03-14 05:19:56 EDT - P+0Y0M0DT2H3M1S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_dt_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_post_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_post_type2_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M1DT18H49M39S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_post_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P-0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_post_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M0DT1H2M4S = **2010-03-15 18:57:55 EDT**
+test_time_spring_type3_stsec_type2_dtsec: SUB: 2010-03-15 03:00:00 EDT - P+0Y0M0DT0H0M1S = **2010-03-13 01:59:59 EST**
+test_time_spring_type3_dtsec_type2_stsec: SUB: 2010-03-15 01:59:59 EST - P-0Y0M0DT0H0M1S = **2010-03-15 03:00:00 EDT**
diff --git a/ext/date/tests/DateTime_sub-spring-type3-type3.phpt b/ext/date/tests/DateTime_sub-spring-type3-type3.phpt
new file mode 100644
index 0000000..2ed190f
--- /dev/null
+++ b/ext/date/tests/DateTime_sub-spring-type3-type3.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DateTime::sub() -- spring type3 type3
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+Various bugs exist
+--FILE--
+<?php
+
+require 'examine_diff.inc';
+define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_SUB);
+require 'DateTime_data-spring-type3-type3.inc';
+
+?>
+--EXPECT--
+test_time_spring_type3_prev_type3_prev: SUB: 2010-03-13 18:38:28 EST - P+0Y1M2DT16H19M40S = **2010-02-11 02:18:48 EST**
+test_time_spring_type3_prev_type3_st: SUB: 2010-03-14 00:10:20 EST - P+0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_prev_type3_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT7H38M27S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_prev_type3_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EST**
+test_time_spring_type3_st_type3_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_st_type3_st: SUB: 2010-03-14 00:15:35 EST - P+0Y0M0DT0H5M15S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_st_type3_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT2H6M35S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_st_type3_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT18H49M39S = **2010-03-14 00:10:20 EST**
+test_time_spring_type3_dt_type3_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT7H38M27S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_dt_type3_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M0DT2H6M35S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_dt_type3_dt: SUB: 2010-03-14 05:19:56 EDT - P+0Y0M0DT2H3M1S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_dt_type3_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT**
+test_time_spring_type3_post_type3_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_post_type3_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M1DT18H49M39S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_post_type3_dt: SUB: 2010-03-14 03:16:55 EDT - P-0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT**
+test_time_spring_type3_post_type3_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M0DT1H2M4S = **2010-03-15 18:57:55 EDT**
+test_time_spring_type3_stsec_type3_dtsec: SUB: 2010-03-15 03:00:00 EDT - P+0Y0M0DT0H0M1S = **2010-03-13 01:59:59 EST**
+test_time_spring_type3_dtsec_type3_stsec: SUB: 2010-03-15 01:59:59 EST - P-0Y0M0DT0H0M1S = **2010-03-15 03:00:00 EDT**
diff --git a/ext/date/tests/DateTime_verify.phpt b/ext/date/tests/DateTime_verify.phpt
new file mode 100644
index 0000000..a03911f
--- /dev/null
+++ b/ext/date/tests/DateTime_verify.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test DateTime class registration
+--FILE--
+<?php
+
+echo "*** Verify DateTime class ***\n";
+
+echo "Verify DateTime class registered OK\n";
+$class = new ReflectionClass('DateTime');
+var_dump($class);
+
+echo "..and get names of all its methods\n";
+$methods = $class->getMethods();
+var_dump($methods);
+
+echo "..and get names of all its class constants\n";
+$constants = $class->getConstants();
+var_dump($constants);
+
+?>
+===DONE===
+--EXPECTF--
+*** Verify DateTime class ***
+Verify DateTime class registered OK
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(8) "DateTime"
+}
+..and get names of all its methods
+array(18) {
+ [0]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(11) "__construct"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [1]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(8) "__wakeup"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [2]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(11) "__set_state"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [3]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(16) "createFromFormat"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [4]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(13) "getLastErrors"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [5]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(6) "format"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [6]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(6) "modify"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [7]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(3) "add"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [8]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(3) "sub"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [9]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(11) "getTimezone"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [10]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(11) "setTimezone"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [11]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(9) "getOffset"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [12]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(7) "setTime"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [13]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(7) "setDate"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [14]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(10) "setISODate"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [15]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(12) "setTimestamp"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [16]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(12) "getTimestamp"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+ [17]=>
+ &object(ReflectionMethod)#%d (2) {
+ ["name"]=>
+ string(4) "diff"
+ ["class"]=>
+ string(8) "DateTime"
+ }
+}
+..and get names of all its class constants
+array(11) {
+ ["ATOM"]=>
+ string(13) "Y-m-d\TH:i:sP"
+ ["COOKIE"]=>
+ string(16) "l, d-M-y H:i:s T"
+ ["ISO8601"]=>
+ string(13) "Y-m-d\TH:i:sO"
+ ["RFC822"]=>
+ string(16) "D, d M y H:i:s O"
+ ["RFC850"]=>
+ string(16) "l, d-M-y H:i:s T"
+ ["RFC1036"]=>
+ string(16) "D, d M y H:i:s O"
+ ["RFC1123"]=>
+ string(16) "D, d M Y H:i:s O"
+ ["RFC2822"]=>
+ string(16) "D, d M Y H:i:s O"
+ ["RFC3339"]=>
+ string(13) "Y-m-d\TH:i:sP"
+ ["RSS"]=>
+ string(16) "D, d M Y H:i:s O"
+ ["W3C"]=>
+ string(13) "Y-m-d\TH:i:sP"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/big_year.phpt b/ext/date/tests/big_year.phpt
new file mode 100644
index 0000000..a15a093
--- /dev/null
+++ b/ext/date/tests/big_year.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Handling of large year values
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set("America/Toronto");
+
+$t = mktime(0,0,0,1,1,292277026596);
+
+var_dump(date("r", $t));
+
+echo "OK\n";
+?>
+--EXPECT--
+string(36) "Fri, 01 Jan 219250468 00:00:00 -0500"
+OK
diff --git a/ext/date/tests/bug13142.phpt b/ext/date/tests/bug13142.phpt
new file mode 100644
index 0000000..5254142
--- /dev/null
+++ b/ext/date/tests/bug13142.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #13142 (strtotime handling of "M d H:i:s Y" format)
+--INI--
+date.timezone=US/Eastern
+--SKIPIF--
+<?php
+if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
+ die("skip. set TZ env is not supported at runtime.");
+}
+if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+?>
+--FILE--
+<?php
+
+if (date('T') == 'GMT') {
+ putenv("TZ=EST5EDT4,M4.1.0,M10.5.0");
+}
+echo date("r\n", strtotime("Sep 04 16:39:45 2001"));
+echo date("r\n", strtotime("Sep 04 2001 16:39:45"));
+?>
+--EXPECT--
+Tue, 04 Sep 2001 16:39:45 -0400
+Tue, 04 Sep 2001 16:39:45 -0400
diff --git a/ext/date/tests/bug14561.phpt b/ext/date/tests/bug14561.phpt
new file mode 100644
index 0000000..86a64fd
--- /dev/null
+++ b/ext/date/tests/bug14561.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #14561 (strtotime() bug)
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+echo strtotime("19:30 Dec 17 2005"), "\n";
+echo strtotime("Dec 17 19:30 2005"), "\n";
+?>
+--EXPECT--
+1134847800
+1134847800
diff --git a/ext/date/tests/bug17988.phpt b/ext/date/tests/bug17988.phpt
new file mode 100644
index 0000000..e758b16
--- /dev/null
+++ b/ext/date/tests/bug17988.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #17988 (strtotime handling of postgresql timestamps)
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 GMT"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MET"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MEST"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 EDT"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-00"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+00"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-04"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+04"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0300"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0300"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0330"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0330"))."\n";
+?>
+--EXPECT--
+2002-06-25 14:18:48
+2002-06-25 14:18:48
+2002-06-25 13:18:48
+2002-06-25 12:18:48
+2002-06-25 18:18:48
+2002-06-25 14:18:48
+2002-06-25 14:18:48
+2002-06-25 18:18:48
+2002-06-25 10:18:48
+2002-06-25 17:18:48
+2002-06-25 11:18:48
+2002-06-25 17:48:48
+2002-06-25 10:48:48
diff --git a/ext/date/tests/bug20382-1.phpt b/ext/date/tests/bug20382-1.phpt
new file mode 100644
index 0000000..e81ac20
--- /dev/null
+++ b/ext/date/tests/bug20382-1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #20382 [1] (strtotime ("Monday", $date) produces wrong result on DST changeover)
+--INI--
+date.timezone=Europe/Amsterdam
+--FILE--
+<?php
+ $tStamp = mktime (17, 17, 17, 10, 27, 2004);
+ echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
+
+ $strtotime_timestamp = strtotime ("Monday", $tStamp);
+ echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n";
+ echo "wanted=Monday 2004-11-01 00:00:00 CET\n";
+?>
+--EXPECT--
+tStamp=Wednesday 2004-10-27 17:17:17 CEST
+result=Monday 2004-11-01 00:00:00 CET
+wanted=Monday 2004-11-01 00:00:00 CET
diff --git a/ext/date/tests/bug20382-2.phpt b/ext/date/tests/bug20382-2.phpt
new file mode 100644
index 0000000..5e07568
--- /dev/null
+++ b/ext/date/tests/bug20382-2.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Bug #20382 [2] (strtotime ("Monday", $date) produces wrong result on DST changeover)
+--FILE--
+<?php
+
+$tests = array(
+ array("Europe/Andorra", 17, 17, 17, 1, 24764, 1970),
+ array("Asia/Dubai", 17, 17, 17, 1, 1, 1970),
+ array("Asia/Kabul", 17, 17, 17, 1, 1, 1970),
+ array("America/Antigua", 17, 17, 17, 1, 1, 1970),
+ array("America/Anguilla", 17, 17, 17, 1, 1, 1970),
+ array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970),
+ array("Asia/Yerevan", 17, 17, 17, 1, 24764, 1970),
+ array("America/Curacao", 17, 17, 17, 1, 1, 1970),
+ array("Africa/Luanda", 17, 17, 17, 1, 1, 1970),
+ array("Antarctica/McMurdo", 17, 17, 17, 1, 24743, 1970),
+ array("Australia/Adelaide", 17, 17, 17, 1, 1, 1971),
+ array("Australia/Darwin", 17, 17, 17, 1, 88, 1971),
+ array("Australia/Perth", 17, 17, 17, 1, 1, 1971),
+ array("America/Aruba", 17, 17, 17, 1, 88, 1971),
+ array("Asia/Baku", 17, 17, 17, 1, 1, 1971),
+ array("Europe/Sarajevo", 17, 17, 17, 1, 1, 1971),
+ array("America/Barbados", 17, 17, 17, 1, 1, 1971),
+ array("Asia/Dacca", 17, 17, 17, 1, 1, 1971),
+ array("Europe/Brussels", 17, 17, 17, 1, 1, 1971),
+ array("Africa/Ouagadougou", 17, 17, 17, 1, 88, 1971),
+ array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970),
+ array("America/Buenos_Aires", 17, 17, 17, 1, 1734, 1970),
+ array("America/Rosario", 17, 17, 17, 1, 1734, 1970),
+ array("Europe/Vienna", 17, 17, 17, 1, 3743, 1970),
+ array("Asia/Baku", 17, 17, 17, 1, 9490, 1970),
+);
+
+foreach ($tests as $test) {
+ date_default_timezone_set($test[0]);
+ print "{$test[0]}\n";
+ array_shift($test);
+ $timestamp = call_user_func_array('mktime', $test);
+
+ print "ts = ". date("l Y-m-d H:i:s T", $timestamp). "\n";
+ $strtotime_tstamp = strtotime("first monday", $timestamp);
+ print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
+ print "wanted = Monday 00:00:00\n\n";
+}
+?>
+--EXPECT--
+Europe/Andorra
+ts = Monday 2037-10-19 17:17:17 CEST
+result = Monday 2037-10-26 00:00:00 CET
+wanted = Monday 00:00:00
+
+Asia/Dubai
+ts = Thursday 1970-01-01 17:17:17 GST
+result = Monday 1970-01-05 00:00:00 GST
+wanted = Monday 00:00:00
+
+Asia/Kabul
+ts = Thursday 1970-01-01 17:17:17 AFT
+result = Monday 1970-01-05 00:00:00 AFT
+wanted = Monday 00:00:00
+
+America/Antigua
+ts = Thursday 1970-01-01 17:17:17 AST
+result = Monday 1970-01-05 00:00:00 AST
+wanted = Monday 00:00:00
+
+America/Anguilla
+ts = Thursday 1970-01-01 17:17:17 AST
+result = Monday 1970-01-05 00:00:00 AST
+wanted = Monday 00:00:00
+
+Europe/Tirane
+ts = Monday 1983-04-11 17:17:17 CET
+result = Monday 1983-04-18 01:00:00 CEST
+wanted = Monday 00:00:00
+
+Asia/Yerevan
+ts = Monday 2037-10-19 17:17:17 AMT
+result = Monday 2037-10-26 00:00:00 AMT
+wanted = Monday 00:00:00
+
+America/Curacao
+ts = Thursday 1970-01-01 17:17:17 AST
+result = Monday 1970-01-05 00:00:00 AST
+wanted = Monday 00:00:00
+
+Africa/Luanda
+ts = Thursday 1970-01-01 17:17:17 WAT
+result = Monday 1970-01-05 00:00:00 WAT
+wanted = Monday 00:00:00
+
+Antarctica/McMurdo
+ts = Monday 2037-09-28 17:17:17 NZDT
+result = Monday 2037-10-05 00:00:00 NZDT
+wanted = Monday 00:00:00
+
+Australia/Adelaide
+ts = Friday 1971-01-01 17:17:17 CST
+result = Monday 1971-01-04 00:00:00 CST
+wanted = Monday 00:00:00
+
+Australia/Darwin
+ts = Monday 1971-03-29 17:17:17 CST
+result = Monday 1971-04-05 00:00:00 CST
+wanted = Monday 00:00:00
+
+Australia/Perth
+ts = Friday 1971-01-01 17:17:17 WST
+result = Monday 1971-01-04 00:00:00 WST
+wanted = Monday 00:00:00
+
+America/Aruba
+ts = Monday 1971-03-29 17:17:17 AST
+result = Monday 1971-04-05 00:00:00 AST
+wanted = Monday 00:00:00
+
+Asia/Baku
+ts = Friday 1971-01-01 17:17:17 BAKT
+result = Monday 1971-01-04 00:00:00 BAKT
+wanted = Monday 00:00:00
+
+Europe/Sarajevo
+ts = Friday 1971-01-01 17:17:17 CET
+result = Monday 1971-01-04 00:00:00 CET
+wanted = Monday 00:00:00
+
+America/Barbados
+ts = Friday 1971-01-01 17:17:17 AST
+result = Monday 1971-01-04 00:00:00 AST
+wanted = Monday 00:00:00
+
+Asia/Dacca
+ts = Friday 1971-01-01 17:17:17 DACT
+result = Monday 1971-01-04 00:00:00 DACT
+wanted = Monday 00:00:00
+
+Europe/Brussels
+ts = Friday 1971-01-01 17:17:17 CET
+result = Monday 1971-01-04 00:00:00 CET
+wanted = Monday 00:00:00
+
+Africa/Ouagadougou
+ts = Monday 1971-03-29 17:17:17 GMT
+result = Monday 1971-04-05 00:00:00 GMT
+wanted = Monday 00:00:00
+
+Europe/Tirane
+ts = Monday 1983-04-11 17:17:17 CET
+result = Monday 1983-04-18 01:00:00 CEST
+wanted = Monday 00:00:00
+
+America/Buenos_Aires
+ts = Monday 1974-09-30 17:17:17 ART
+result = Monday 1974-10-07 00:00:00 ART
+wanted = Monday 00:00:00
+
+America/Rosario
+ts = Monday 1974-09-30 17:17:17 ART
+result = Monday 1974-10-07 00:00:00 ART
+wanted = Monday 00:00:00
+
+Europe/Vienna
+ts = Monday 1980-03-31 17:17:17 CET
+result = Monday 1980-04-07 00:00:00 CEST
+wanted = Monday 00:00:00
+
+Asia/Baku
+ts = Monday 1995-12-25 17:17:17 AZT
+result = Monday 1996-01-01 00:00:00 AZT
+wanted = Monday 00:00:00
diff --git a/ext/date/tests/bug21399.phpt b/ext/date/tests/bug21399.phpt
new file mode 100644
index 0000000..a295c8b
--- /dev/null
+++ b/ext/date/tests/bug21399.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #21399 (strtotime() request for "YYYYMMDDhhmmss [ZZZ]")
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+ echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT"));
+?>
+--EXPECT--
+2005-06-20 09:14:07
diff --git a/ext/date/tests/bug21966.phpt b/ext/date/tests/bug21966.phpt
new file mode 100644
index 0000000..353e7e5
--- /dev/null
+++ b/ext/date/tests/bug21966.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #21966 (date() or mktime() returning bad value for mktime month param of '2')
+--INI--
+date.timezone=Europe/London
+--FILE--
+<?php
+echo '27/3/04 = ' . strval(mktime(0,0,0,3,27,2004)) . "\n"; // 1080345600
+echo '28/3/04 = ' . strval(mktime(0,0,0,3,28,2004)) . "\n"; // -3662 - should be 108043200
+echo '28/3/04 = ' . strval(mktime(2,0,0,3,28,2004)) . "\n"; // 1080435600
+echo '29/3/04 = ' . strval(mktime(0,0,0,3,29,2004)) . "\n"; // 1080514800
+echo '30/3/04 = ' . strval(mktime(0,0,0,3,30,2004)) . "\n"; // 1080601200
+
+?>
+--EXPECT--
+27/3/04 = 1080345600
+28/3/04 = 1080432000
+28/3/04 = 1080435600
+29/3/04 = 1080514800
+30/3/04 = 1080601200
diff --git a/ext/date/tests/bug26090.phpt b/ext/date/tests/bug26090.phpt
new file mode 100644
index 0000000..4b81949
--- /dev/null
+++ b/ext/date/tests/bug26090.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #26090 (allow colons in time zone offset to strtotime())
+--INI--
+date.timezone=America/New_York
+--FILE--
+<?php
+$t = '2003-10-28 10:20:30-0800';
+echo date('Y-m-d H:i:s T', strtotime($t)) . "\n";
+
+$t = '2003-10-28 10:20:30-08:00';
+echo date('Y-m-d H:i:s T', strtotime($t)) . "\n";
+?>
+--EXPECT--
+2003-10-28 13:20:30 EST
+2003-10-28 13:20:30 EST
diff --git a/ext/date/tests/bug26198.phpt b/ext/date/tests/bug26198.phpt
new file mode 100644
index 0000000..c957bfc
--- /dev/null
+++ b/ext/date/tests/bug26198.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #26198 (strtotime handling of "M Y" and "Y M" format)
+--FILE--
+<?php
+ date_default_timezone_set("GMT");
+ echo gmdate("F Y (Y-m-d H:i:s T)\n", strtotime("Oct 2001"));
+ echo gmdate("M Y (Y-m-d H:i:s T)\n", strtotime("2001 Oct"));
+?>
+--EXPECT--
+October 2001 (2001-10-01 00:00:00 GMT)
+Oct 2001 (2001-10-01 00:00:00 GMT)
diff --git a/ext/date/tests/bug26317.phpt b/ext/date/tests/bug26317.phpt
new file mode 100644
index 0000000..5b79bec
--- /dev/null
+++ b/ext/date/tests/bug26317.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #26317 (military timezone offset signedness)
+--INI--
+date.timezone=GMT0
+--SKIPIF--
+if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+--FILE--
+<?php
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C"));
+?>
+--EXPECT--
+2003-11-19 16:20:42
+2003-11-19 16:20:42
+2003-11-19 16:20:42
diff --git a/ext/date/tests/bug26320.phpt b/ext/date/tests/bug26320.phpt
new file mode 100644
index 0000000..c8aeb00
--- /dev/null
+++ b/ext/date/tests/bug26320.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #26320 (strtotime handling of XML Schema/ISO 8601 format)
+--INI--
+date.timezone=GMT0
+--SKIPIF--
+if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+--FILE--
+<?php
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z"));
+?>
+--EXPECT--
+2003-11-19 12:30:42
+2003-11-19 12:30:42
diff --git a/ext/date/tests/bug26694.phpt b/ext/date/tests/bug26694.phpt
new file mode 100644
index 0000000..939b04c
--- /dev/null
+++ b/ext/date/tests/bug26694.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #26694 (strtotime() request for "Sun, 21 Dec 2003 20:38:33 +0000 GMT")
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+ echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT"));
+?>
+--EXPECT--
+2003-12-21 20:38:33
diff --git a/ext/date/tests/bug27719.phpt b/ext/date/tests/bug27719.phpt
new file mode 100644
index 0000000..88c1770
--- /dev/null
+++ b/ext/date/tests/bug27719.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Bug #27719 (mktime returns incorrect timestamp for dst days)
+--INI--
+date.timezone=EST
+error_reporting=2047
+--FILE--
+<?php /* $Id$ */
+ $a = mktime(0, 0, 0, 4, 4, 2004, 0);
+ $b = mktime(0, 0, 0, 4, 4, 2004, 1);
+ $c = mktime(0, 0, 0, 4, 4, 2004, -1);
+ echo "$a ".date("m/d/y h:i:s\n",$a);
+ echo "$b ".date("m/d/y h:i:s\n",$b);
+ echo "$c ".date("m/d/y h:i:s\n",$c);
+ echo "\n";
+ date_default_timezone_set('EST5EDT'); // DST not in effect
+ $a = mktime(0, 0, 0, 2, 4, 2004, 0);
+ $b = mktime(0, 0, 0, 2, 4, 2004, 1);
+ $c = mktime(0, 0, 0, 2, 4, 2004, -1);
+ echo "$a ".date("m/d/y h:i:s\n",$a);
+ echo "$b ".date("m/d/y h:i:s\n",$b);
+ echo "$c ".date("m/d/y h:i:s\n",$c);
+ echo "\n";
+ date_default_timezone_set('EST5EDT');
+ $a = mktime(0, 0, 0, 4, 4, 2004, 0);
+ $b = mktime(0, 0, 0, 4, 4, 2004, 1);
+ $c = mktime(0, 0, 0, 4, 4, 2004, -1);
+ echo "$a ".date("m/d/y h:i:s\n",$a);
+ echo "$b ".date("m/d/y h:i:s\n",$b);
+ echo "$c ".date("m/d/y h:i:s\n",$c);
+ echo "\n";
+ date_default_timezone_set('EST5EDT');
+ $a = mktime(3, 0, 0, 4, 4, 2004, 0);
+ $b = mktime(3, 0, 0, 4, 4, 2004, 1);
+ $c = mktime(3, 0, 0, 4, 4, 2004, -1);
+ echo "$a ".date("m/d/y h:i:s\n",$a);
+ echo "$b ".date("m/d/y h:i:s\n",$b);
+ echo "$c ".date("m/d/y h:i:s\n",$c);
+ echo "\n";
+ date_default_timezone_set('EST5EDT');
+ $a = mktime(0, 0, 0, 6, 4, 2004, 0);
+ $b = mktime(0, 0, 0, 6, 4, 2004, 1);
+ $c = mktime(0, 0, 0, 6, 4, 2004, -1);
+ echo "$a ".date("m/d/y h:i:s\n",$a);
+ echo "$b ".date("m/d/y h:i:s\n",$b);
+ echo "$c ".date("m/d/y h:i:s\n",$c);
+ echo "\n";
+?>
+--EXPECTF--
+1081054800 04/04/04 12:00:00
+%s
+1081054800 04/04/04 12:00:00
+
+1075870800 02/04/04 12:00:00
+1075867200 02/03/04 11:00:00
+1075870800 02/04/04 12:00:00
+
+1081054800 04/04/04 12:00:00
+1081051200 04/03/04 11:00:00
+1081054800 04/04/04 12:00:00
+
+1081065600 04/04/04 04:00:00
+1081062000 04/04/04 03:00:00
+1081062000 04/04/04 03:00:00
+
+1086325200 06/04/04 01:00:00
+1086321600 06/04/04 12:00:00
+1086321600 06/04/04 12:00:00
diff --git a/ext/date/tests/bug27780.phpt b/ext/date/tests/bug27780.phpt
new file mode 100644
index 0000000..af35b8f
--- /dev/null
+++ b/ext/date/tests/bug27780.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Bug #27780 (strtotime(+1 xxx) returns a wrong date/time)
+--SKIPIF--
+<?php
+if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
+ die("skip. Not the same TZ on windows.");
+}
+--FILE--
+<?php
+$timezones = array (
+ "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem",
+ "Asia/Singapore", "America/Sao_Paulo"
+);
+
+$timestrings = array (
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds",
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds",
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds",
+ "2004-04-07 00:00:00 -21 days",
+ "2004-04-07 00:00:00 11 days ago",
+ "2004-04-07 00:00:00 -10 day +2 hours",
+ "2004-04-07 00:00:00 -1 day",
+ "2004-04-07 00:00:00",
+ "2004-04-07 00:00:00 +1 hour",
+ "2004-04-07 00:00:00 +2 hour",
+ "2004-04-07 00:00:00 +1 day",
+ "2004-04-07 00:00:00 1 day",
+ "2004-04-07 00:00:00 +21 days",
+);
+
+foreach ($timezones as $timezone) {
+ date_default_timezone_set($timezone);
+ echo $timezone, "\n";
+
+ foreach ($timestrings as $timestring) {
+ $time = strtotime($timestring);
+
+ echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n";
+ }
+
+ echo "\n";
+}
+?>
+--EXPECT--
+America/Chicago
+1076824799 [2004-02-14 23:59:59 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076824800 [2004-02-15 00:00:00 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076824801 [2004-02-15 00:00:01 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079503200 [2004-03-17 00:00:00 CST] [2004-04-07 00:00:00 -21 days]
+1080367200 [2004-03-27 00:00:00 CST] [2004-04-07 00:00:00 11 days ago]
+1080460800 [2004-03-28 02:00:00 CST] [2004-04-07 00:00:00 -10 day +2 hours]
+1081227600 [2004-04-06 00:00:00 CDT] [2004-04-07 00:00:00 -1 day]
+1081314000 [2004-04-07 00:00:00 CDT] [2004-04-07 00:00:00]
+1081317600 [2004-04-07 01:00:00 CDT] [2004-04-07 00:00:00 +1 hour]
+1081321200 [2004-04-07 02:00:00 CDT] [2004-04-07 00:00:00 +2 hour]
+1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 +1 day]
+1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 1 day]
+1083128400 [2004-04-28 00:00:00 CDT] [2004-04-07 00:00:00 +21 days]
+
+Europe/Amsterdam
+1076799599 [2004-02-14 23:59:59 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076799600 [2004-02-15 00:00:00 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076799601 [2004-02-15 00:00:01 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079478000 [2004-03-17 00:00:00 CET] [2004-04-07 00:00:00 -21 days]
+1080342000 [2004-03-27 00:00:00 CET] [2004-04-07 00:00:00 11 days ago]
+1080435600 [2004-03-28 03:00:00 CEST] [2004-04-07 00:00:00 -10 day +2 hours]
+1081202400 [2004-04-06 00:00:00 CEST] [2004-04-07 00:00:00 -1 day]
+1081288800 [2004-04-07 00:00:00 CEST] [2004-04-07 00:00:00]
+1081292400 [2004-04-07 01:00:00 CEST] [2004-04-07 00:00:00 +1 hour]
+1081296000 [2004-04-07 02:00:00 CEST] [2004-04-07 00:00:00 +2 hour]
+1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 +1 day]
+1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 1 day]
+1083103200 [2004-04-28 00:00:00 CEST] [2004-04-07 00:00:00 +21 days]
+
+Asia/Jerusalem
+1076795999 [2004-02-14 23:59:59 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076796000 [2004-02-15 00:00:00 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076796001 [2004-02-15 00:00:01 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079474400 [2004-03-17 00:00:00 IST] [2004-04-07 00:00:00 -21 days]
+1080338400 [2004-03-27 00:00:00 IST] [2004-04-07 00:00:00 11 days ago]
+1080432000 [2004-03-28 02:00:00 IST] [2004-04-07 00:00:00 -10 day +2 hours]
+1081202400 [2004-04-06 00:00:00 IST] [2004-04-07 00:00:00 -1 day]
+1081288800 [2004-04-07 00:00:00 IST] [2004-04-07 00:00:00]
+1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +1 hour]
+1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +2 hour]
+1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 +1 day]
+1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 1 day]
+1083099600 [2004-04-28 00:00:00 IDT] [2004-04-07 00:00:00 +21 days]
+
+Asia/Singapore
+1076774399 [2004-02-14 23:59:59 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076774400 [2004-02-15 00:00:00 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076774401 [2004-02-15 00:00:01 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079452800 [2004-03-17 00:00:00 SGT] [2004-04-07 00:00:00 -21 days]
+1080316800 [2004-03-27 00:00:00 SGT] [2004-04-07 00:00:00 11 days ago]
+1080410400 [2004-03-28 02:00:00 SGT] [2004-04-07 00:00:00 -10 day +2 hours]
+1081180800 [2004-04-06 00:00:00 SGT] [2004-04-07 00:00:00 -1 day]
+1081267200 [2004-04-07 00:00:00 SGT] [2004-04-07 00:00:00]
+1081270800 [2004-04-07 01:00:00 SGT] [2004-04-07 00:00:00 +1 hour]
+1081274400 [2004-04-07 02:00:00 SGT] [2004-04-07 00:00:00 +2 hour]
+1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 +1 day]
+1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 1 day]
+1083081600 [2004-04-28 00:00:00 SGT] [2004-04-07 00:00:00 +21 days]
+
+America/Sao_Paulo
+1076810399 [2004-02-14 23:59:59 BRST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076814000 [2004-02-15 00:00:00 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076814001 [2004-02-15 00:00:01 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079492400 [2004-03-17 00:00:00 BRT] [2004-04-07 00:00:00 -21 days]
+1080356400 [2004-03-27 00:00:00 BRT] [2004-04-07 00:00:00 11 days ago]
+1080450000 [2004-03-28 02:00:00 BRT] [2004-04-07 00:00:00 -10 day +2 hours]
+1081220400 [2004-04-06 00:00:00 BRT] [2004-04-07 00:00:00 -1 day]
+1081306800 [2004-04-07 00:00:00 BRT] [2004-04-07 00:00:00]
+1081310400 [2004-04-07 01:00:00 BRT] [2004-04-07 00:00:00 +1 hour]
+1081314000 [2004-04-07 02:00:00 BRT] [2004-04-07 00:00:00 +2 hour]
+1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 +1 day]
+1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 1 day]
+1083121200 [2004-04-28 00:00:00 BRT] [2004-04-07 00:00:00 +21 days]
diff --git a/ext/date/tests/bug28024.phpt b/ext/date/tests/bug28024.phpt
new file mode 100644
index 0000000..b5f97bd
--- /dev/null
+++ b/ext/date/tests/bug28024.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #28024 (Changed behavior of strtotime())
+--INI--
+date.timezone=Europe/Berlin
+--FILE--
+<?php
+ echo strtotime("17:00 2004-01-01"), "\n";
+ echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01"));
+?>
+--EXPECT--
+1072972800
+2004-01-01 17:00:00 CET
diff --git a/ext/date/tests/bug28088.phpt b/ext/date/tests/bug28088.phpt
new file mode 100644
index 0000000..c310139
--- /dev/null
+++ b/ext/date/tests/bug28088.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #28088 (strtotime() cannot convert 00 hours")
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+echo "The following line rightly shows the correct date time:\n";
+echo gmdate("m/d/y Hi", strtotime("04/04/04 2345")), "\n";
+
+echo "But the following line fails to show the correct date time:\n";
+echo gmdate("m/d/y Hi", strtotime("04/04/04 0045"))."\r\n";
+?>
+--EXPECT--
+The following line rightly shows the correct date time:
+04/04/04 2345
+But the following line fails to show the correct date time:
+04/04/04 0045
diff --git a/ext/date/tests/bug28599.phpt b/ext/date/tests/bug28599.phpt
new file mode 100644
index 0000000..fcd17b4
--- /dev/null
+++ b/ext/date/tests/bug28599.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #28599 (strtotime fails with zero base time)
+--FILE--
+<?php
+date_default_timezone_set("Europe/Amsterdam");
+print gmdate("d-m-Y H:i:s", strtotime("+30 minutes", 1100535573));
+?>
+--EXPECT--
+15-11-2004 16:49:33
diff --git a/ext/date/tests/bug29150.phpt b/ext/date/tests/bug29150.phpt
new file mode 100644
index 0000000..d91d68d
--- /dev/null
+++ b/ext/date/tests/bug29150.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #29150 (Roman number format for months)
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+ echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005"));
+?>
+--EXPECT--
+2005-06-20 00:00:00
diff --git a/ext/date/tests/bug29585.phpt b/ext/date/tests/bug29585.phpt
new file mode 100644
index 0000000..3945699
--- /dev/null
+++ b/ext/date/tests/bug29585.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #29585 (Support week numbers in strtotime())
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+echo gmdate("Y-m-d H:i:s", strtotime("2004W30"));
+?>
+--EXPECT--
+2004-07-19 00:00:00
diff --git a/ext/date/tests/bug29595.phpt b/ext/date/tests/bug29595.phpt
new file mode 100644
index 0000000..285ade1
--- /dev/null
+++ b/ext/date/tests/bug29595.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #29595 (Roman number format for months)
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+$from_postgres = '2004-08-09 14:48:27.304809+10';
+
+echo strtotime($from_postgres);
+?>
+--EXPECT--
+1092026907
diff --git a/ext/date/tests/bug30096.phpt b/ext/date/tests/bug30096.phpt
new file mode 100644
index 0000000..fa4f716
--- /dev/null
+++ b/ext/date/tests/bug30096.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Bug #30096 (gmmktime does not return the corrent time)
+--INI--
+error_reporting=2047
+--FILE--
+<?php
+echo "no dst --> dst\n";
+$ts = -1;
+gm_date_check(01,00,00,03,27,2005);
+gm_date_check(02,00,00,03,27,2005);
+gm_date_check(03,00,00,03,27,2005);
+gm_date_check(04,00,00,03,27,2005);
+
+echo "\ndst --> no dst\n";
+$ts = -1;
+gm_date_check(01,00,00,10,30,2005);
+gm_date_check(02,00,00,10,30,2005);
+gm_date_check(03,00,00,10,30,2005);
+gm_date_check(04,00,00,10,30,2005);
+
+function gm_date_check($hour, $minute, $second, $month, $day, $year) {
+ global $ts, $tsold;
+
+ echo "gmmktime($hour,$minute,$second,$month,$day,$year): ";
+
+ $tsold = $ts;
+ $ts = gmmktime($hour, $minute, $second, $month, $day, $year);
+
+ echo $ts, " | gmdate('r', $ts):", gmdate('r', $ts);
+ if ($tsold > 0) {
+ echo " | Diff: " . ($ts - $tsold);
+ }
+ echo "\n";
+}
+
+?>
+--EXPECT--
+no dst --> dst
+gmmktime(1,0,0,3,27,2005): 1111885200 | gmdate('r', 1111885200):Sun, 27 Mar 2005 01:00:00 +0000
+gmmktime(2,0,0,3,27,2005): 1111888800 | gmdate('r', 1111888800):Sun, 27 Mar 2005 02:00:00 +0000 | Diff: 3600
+gmmktime(3,0,0,3,27,2005): 1111892400 | gmdate('r', 1111892400):Sun, 27 Mar 2005 03:00:00 +0000 | Diff: 3600
+gmmktime(4,0,0,3,27,2005): 1111896000 | gmdate('r', 1111896000):Sun, 27 Mar 2005 04:00:00 +0000 | Diff: 3600
+
+dst --> no dst
+gmmktime(1,0,0,10,30,2005): 1130634000 | gmdate('r', 1130634000):Sun, 30 Oct 2005 01:00:00 +0000
+gmmktime(2,0,0,10,30,2005): 1130637600 | gmdate('r', 1130637600):Sun, 30 Oct 2005 02:00:00 +0000 | Diff: 3600
+gmmktime(3,0,0,10,30,2005): 1130641200 | gmdate('r', 1130641200):Sun, 30 Oct 2005 03:00:00 +0000 | Diff: 3600
+gmmktime(4,0,0,10,30,2005): 1130644800 | gmdate('r', 1130644800):Sun, 30 Oct 2005 04:00:00 +0000 | Diff: 3600
diff --git a/ext/date/tests/bug30532.phpt b/ext/date/tests/bug30532.phpt
new file mode 100644
index 0000000..6794b9d
--- /dev/null
+++ b/ext/date/tests/bug30532.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #30532 (strtotime - crossing daylight savings time)
+--INI--
+date.timezone=America/New_York
+--FILE--
+<?php
+
+echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +1 hour'))."\n";
+echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +2 hours'))."\n";
+echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +3 hours'))."\n";
+
+echo "\n";
+
+echo date('Y-m-d H:i:s T', strtotime('2004-10-31 +1 hour'))."\n";
+echo date('Y-m-d H:i:s T', strtotime('2004-10-31 +2 hours'))."\n";
+echo date('Y-m-d H:i:s T', strtotime('2004-10-31 +3 hours'))."\n";
+?>
+--EXPECT--
+2004-10-31 01:00:00 EDT
+2004-10-31 01:00:00 EST
+2004-10-31 02:00:00 EST
+
+2004-10-31 01:00:00 EDT
+2004-10-31 02:00:00 EST
+2004-10-31 03:00:00 EST
diff --git a/ext/date/tests/bug32086.phpt b/ext/date/tests/bug32086.phpt
new file mode 100644
index 0000000..e065c0b
--- /dev/null
+++ b/ext/date/tests/bug32086.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Bug #32086 (strtotime don't work in DST)
+--INI--
+date.timezone=America/Sao_Paulo
+--FILE--
+<?php
+
+echo $g = strtotime("2004-11-01"), "\n";
+echo $i = strtotime("2004-11-01 +1 day"), "\n";
+echo $j = strtotime("+1 day", $g), "\n";
+echo $k = strtotime("2004-11-02"), "\n";
+echo $l = strtotime("2004-11-03"), "\n";
+echo date("Y-m-d H:i:s T\n", $g);
+echo date("Y-m-d H:i:s T\n", $i);
+echo date("Y-m-d H:i:s T\n", $j);
+echo date("Y-m-d H:i:s T\n", $k);
+echo date("Y-m-d H:i:s T\n", $l);
+
+echo $g = strtotime("2005-02-19"), "\n";
+echo $i = strtotime("2005-02-19 +1 day"), "\n";
+echo $j = strtotime("+1 day", $g), "\n";
+echo $k = strtotime("2005-02-20"), "\n";
+echo $l = strtotime("2005-02-21"), "\n";
+echo date("Y-m-d H:i:s T\n", $g);
+echo date("Y-m-d H:i:s T\n", $i);
+echo date("Y-m-d H:i:s T\n", $j);
+echo date("Y-m-d H:i:s T\n", $k);
+echo date("Y-m-d H:i:s T\n", $l);
+
+?>
+--EXPECT--
+1099278000
+1099364400
+1099364400
+1099364400
+1099447200
+2004-11-01 00:00:00 BRT
+2004-11-02 01:00:00 BRST
+2004-11-02 01:00:00 BRST
+2004-11-02 01:00:00 BRST
+2004-11-03 00:00:00 BRST
+1108778400
+1108868400
+1108868400
+1108868400
+1108954800
+2005-02-19 00:00:00 BRST
+2005-02-20 00:00:00 BRT
+2005-02-20 00:00:00 BRT
+2005-02-20 00:00:00 BRT
+2005-02-21 00:00:00 BRT
diff --git a/ext/date/tests/bug32270.phpt b/ext/date/tests/bug32270.phpt
new file mode 100644
index 0000000..4533e06
--- /dev/null
+++ b/ext/date/tests/bug32270.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #32270 (strtotime/date behavior)
+--INI--
+date.timezone=America/Los_Angeles
+--FILE--
+<?php
+
+echo date("m/d/Y H:i:s T", -2145888000)."\n";
+
+echo strtotime("Jan 1 1902")."\n";
+
+echo date("m/d/Y H:i:s T", -631123200)."\n";
+
+echo strtotime("Jan 1 1950")."\n";
+
+echo date("m/d/Y H:i:s T", 946713600)."\n";
+
+echo strtotime("Jan 1 2000")."\n";
+?>
+--EXPECT--
+01/01/1902 00:00:00 PST
+-2145888000
+01/01/1950 00:00:00 PST
+-631123200
+01/01/2000 00:00:00 PST
+946713600
diff --git a/ext/date/tests/bug32555.phpt b/ext/date/tests/bug32555.phpt
new file mode 100644
index 0000000..fca34ff
--- /dev/null
+++ b/ext/date/tests/bug32555.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #32555 (strtotime("tomorrow") can return false)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip strftime uses system TZ');
+?>
+--INI--
+date.timezone=US/Eastern
+--FILE--
+<?php
+$stamp = 1112427000;
+print strftime('%c %Z',strtotime('now',$stamp)) ."\n";
+print strftime('%c %Z',strtotime('tomorrow',$stamp)) ."\n";
+print strftime('%c %Z',strtotime('+1 day',$stamp)) ."\n";
+print strftime('%c %Z',strtotime('+2 day',$stamp)) ."\n";
+?>
+--EXPECT--
+Sat Apr 2 02:30:00 2005 EST
+Sun Apr 3 00:00:00 2005 EST
+Sun Apr 3 03:30:00 2005 EDT
+Mon Apr 4 02:30:00 2005 EDT
diff --git a/ext/date/tests/bug32588.phpt b/ext/date/tests/bug32588.phpt
new file mode 100644
index 0000000..4ecadf4
--- /dev/null
+++ b/ext/date/tests/bug32588.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #32588 (strtotime() error for 'last xxx' DST problem)
+--INI--
+date.timezone=America/New_York
+--FILE--
+<?php
+
+echo date('D Y/m/d/H:i:s', strtotime('last saturday', 1112703348)). "\n";
+echo date('D Y/m/d/H:i:s', strtotime("last sunday", 1112703348)). "\n";
+echo date('D Y/m/d/H:i:s', strtotime('last monday', 1112703348)). "\n";
+--EXPECT--
+Sat 2005/04/02/00:00:00
+Sun 2005/04/03/00:00:00
+Mon 2005/04/04/00:00:00
diff --git a/ext/date/tests/bug33056.phpt b/ext/date/tests/bug33056.phpt
new file mode 100644
index 0000000..441acc5
--- /dev/null
+++ b/ext/date/tests/bug33056.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #33056 (strtotime() does not parse 20050518t090000Z)
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+echo strtotime('20050518t090000Z')."\n";
+echo strtotime('20050518t091234Z')."\n";
+echo strtotime('20050518t191234Z')."\n";
+?>
+--EXPECT--
+1116406800
+1116407554
+1116443554
diff --git a/ext/date/tests/bug33414-1.phpt b/ext/date/tests/bug33414-1.phpt
new file mode 100644
index 0000000..03d9b4c
--- /dev/null
+++ b/ext/date/tests/bug33414-1.phpt
@@ -0,0 +1,321 @@
+--TEST--
+Bug #33414 [1] (Comprehensive list of incorrect days returned after strotime() / date() tests)
+--INI--
+date.timezone=America/Mendoza
+--FILE--
+<?php
+
+print "TZ=America/Mendoza - wrong day.\n";
+$tStamp = mktime (17, 17, 17, 1, 8327, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 00:00:00\n\n";
+
+print "TZ=America/Catamarca - wrong day.\n";
+date_default_timezone_set("America/Catamarca");
+$tStamp = mktime (17, 17, 17, 1, 7599, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 00:00:00\n\n";
+
+print "TZ=America/Cordoba - wrong day.\n";
+date_default_timezone_set("America/Cordoba");
+$tStamp = mktime (17, 17, 17, 1, 7599, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 00:00:00\n\n";
+
+print "TZ=America/Rosario - wrong day.\n";
+date_default_timezone_set("America/Rosario");
+$tStamp = mktime (17, 17, 17, 1, 7958, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:00:00\n\n";
+
+print "TZ=Europe/Vienna - wrong day - giving unexpected results, at
+least on my system :-)\n";
+date_default_timezone_set("Europe/Vienna");
+$tStamp = mktime (17, 17, 17, 1, 3746, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+print "TZ=Asia/Baku - wrong day.\n";
+date_default_timezone_set("Asia/Baku");
+$tStamp = mktime (17, 17, 17, 1, 8299, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 00:00:00\n\n";
+
+print "TZ=America/Noronha - wrong day.\n";
+date_default_timezone_set("America/Noronha");
+$tStamp = mktime (17, 17, 17, 1, 10866, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Friday 00:00:00\n\n";
+
+print "TZ=America/Havana - wrong day.\n";
+date_default_timezone_set("America/Havana");
+$tStamp = mktime (17, 17, 17, 1, 12720, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+print "TZ=Europe/Tallinn - wrong day.\n";
+date_default_timezone_set("Europe/Tallinn");
+$tStamp = mktime (17, 17, 17, 1, 11777, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Saturday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Saturday 00:00:00\n\n";
+
+print "TZ=Asia/Jerusalem - wrong day.\n";
+date_default_timezone_set("Asia/Jerusalem");
+$tStamp = mktime (17, 17, 17, 1, 13056, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+print "TZ=Europe/Vilnius - wrong day.\n";
+date_default_timezone_set("Europe/Vilnius");
+$tStamp = mktime (17, 17, 17, 1, 12140, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Friday 00:00:00\n\n";
+
+print "TZ=Pacific/Kwajalein - wrong day.\n";
+date_default_timezone_set("Pacific/Kwajalein");
+$tStamp = mktime (17, 17, 17, 1, 8626, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Friday 00:00:00\n\n";
+
+print "TZ=Asia/Ulan_Bator - wrong day.\n";
+date_default_timezone_set("Asia/Ulan_Bator");
+$tStamp = mktime (17, 17, 17, 1, 11588, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Saturday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Saturday 00:00:00\n\n";
+
+print "TZ=America/Cancun - wrong day.\n";
+date_default_timezone_set("America/Cancun");
+$tStamp = mktime (17, 17, 17, 1, 11785, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 00:00:00\n\n";
+
+print "TZ=America/Mexico_City - wrong day.\n";
+date_default_timezone_set("America/Mexico_City");
+$tStamp = mktime (17, 17, 17, 1, 11781, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Wednesday 00:00:00\n\n";
+
+print "TZ=America/Mazatlan - wrong day.\n";
+date_default_timezone_set("America/Mazatlan");
+$tStamp = mktime (17, 17, 17, 1, 11780, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:00:00\n\n";
+
+print "TZ=America/Chihuahua - wrong day.\n";
+date_default_timezone_set("America/Chihuahua");
+$tStamp = mktime (17, 17, 17, 1, 11782, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+print "TZ=Asia/Kuala_Lumpur - wrong day.\n";
+date_default_timezone_set("Asia/Kuala_Lumpur");
+$tStamp = mktime (17, 17, 17, 1, 4380, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:00:00\n\n";
+
+print "TZ=Pacific/Chatham - wrong day.\n";
+date_default_timezone_set("Pacific/Chatham");
+$tStamp = mktime (17, 17, 17, 1, 1762, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:00:00\n\n";
+
+print "TZ=America/Lima - wrong day.\n";
+date_default_timezone_set("America/Lima");
+$tStamp = mktime (17, 17, 17, 1, 5839, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+print "TZ=Asia/Karachi - wrong day.\n";
+date_default_timezone_set("Asia/Karachi");
+$tStamp = mktime (17, 17, 17, 1, 11783, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Friday 00:00:00\n\n";
+
+print "TZ=America/Asuncion - wrong day.\n";
+date_default_timezone_set("America/Asuncion");
+$tStamp = mktime (17, 17, 17, 1, 11746, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Wednesday 00:00:00\n\n";
+
+print "TZ=Asia/Singapore - wrong day.\n";
+date_default_timezone_set("Asia/Singapore");
+$tStamp = mktime (17, 17, 17, 1, 4383, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+print "TZ=America/Montevideo - wrong day.\n";
+date_default_timezone_set("America/Montevideo");
+$tStamp = mktime (17, 17, 17, 1, 12678, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+?>
+--EXPECT--
+TZ=America/Mendoza - wrong day.
+tStamp=Sunday 1992-10-18 17:17:17 ARST 1
+result=Sunday 1992-10-25 00:00:00 ARST 1
+wanted=Sunday 00:00:00
+
+TZ=America/Catamarca - wrong day.
+tStamp=Sunday 1990-10-21 17:17:17 ARST 1
+result=Sunday 1990-10-28 00:00:00 ARST 1
+wanted=Sunday 00:00:00
+
+TZ=America/Cordoba - wrong day.
+tStamp=Sunday 1990-10-21 17:17:17 ARST 1
+result=Sunday 1990-10-28 00:00:00 ARST 1
+wanted=Sunday 00:00:00
+
+TZ=America/Rosario - wrong day.
+tStamp=Tuesday 1991-10-15 17:17:17 WART 0
+result=Tuesday 1991-10-22 00:00:00 ARST 1
+wanted=Tuesday 00:00:00
+
+TZ=Europe/Vienna - wrong day - giving unexpected results, at
+least on my system :-)
+tStamp=Thursday 1980-04-03 17:17:17 CET 0
+result=Thursday 1980-04-10 00:00:00 CEST 1
+wanted=Thursday 00:00:00
+
+TZ=Asia/Baku - wrong day.
+tStamp=Sunday 1992-09-20 17:17:17 AZST 1
+result=Sunday 1992-09-27 00:00:00 AZT 0
+wanted=Sunday 00:00:00
+
+TZ=America/Noronha - wrong day.
+tStamp=Friday 1999-10-01 17:17:17 FNT 0
+result=Friday 1999-10-08 00:00:00 FNST 1
+wanted=Friday 00:00:00
+
+TZ=America/Havana - wrong day.
+tStamp=Thursday 2004-10-28 17:17:17 CDT 1
+result=Thursday 2004-11-04 00:00:00 CDT 1
+wanted=Thursday 00:00:00
+
+TZ=Europe/Tallinn - wrong day.
+tStamp=Saturday 2002-03-30 17:17:17 EET 0
+result=Saturday 2002-04-06 00:00:00 EEST 1
+wanted=Saturday 00:00:00
+
+TZ=Asia/Jerusalem - wrong day.
+tStamp=Thursday 2005-09-29 17:17:17 IDT 1
+result=Thursday 2005-10-06 00:00:00 IDT 1
+wanted=Thursday 00:00:00
+
+TZ=Europe/Vilnius - wrong day.
+tStamp=Friday 2003-03-28 17:17:17 EET 0
+result=Friday 2003-04-04 00:00:00 EEST 1
+wanted=Friday 00:00:00
+
+TZ=Pacific/Kwajalein - wrong day.
+tStamp=Friday 1993-08-13 17:17:17 KWAT 0
+result=Saturday 1993-08-21 00:00:00 MHT 0
+wanted=Friday 00:00:00
+
+TZ=Asia/Ulan_Bator - wrong day.
+tStamp=Saturday 2001-09-22 17:17:17 ULAST 1
+result=Saturday 2001-09-29 00:00:00 ULAST 1
+wanted=Saturday 00:00:00
+
+TZ=America/Cancun - wrong day.
+tStamp=Sunday 2002-04-07 17:17:17 CDT 1
+result=Sunday 2002-04-14 00:00:00 CDT 1
+wanted=Sunday 00:00:00
+
+TZ=America/Mexico_City - wrong day.
+tStamp=Wednesday 2002-04-03 17:17:17 CST 0
+result=Wednesday 2002-04-10 00:00:00 CDT 1
+wanted=Wednesday 00:00:00
+
+TZ=America/Mazatlan - wrong day.
+tStamp=Tuesday 2002-04-02 17:17:17 MST 0
+result=Tuesday 2002-04-09 00:00:00 MDT 1
+wanted=Tuesday 00:00:00
+
+TZ=America/Chihuahua - wrong day.
+tStamp=Thursday 2002-04-04 17:17:17 MST 0
+result=Thursday 2002-04-11 00:00:00 MDT 1
+wanted=Thursday 00:00:00
+
+TZ=Asia/Kuala_Lumpur - wrong day.
+tStamp=Monday 1981-12-28 17:17:17 MALT 0
+result=Monday 1982-01-04 00:00:00 MYT 0
+wanted=Monday 00:00:00
+
+TZ=Pacific/Chatham - wrong day.
+tStamp=Monday 1974-10-28 17:17:17 CHAST 0
+result=Monday 1974-11-04 00:00:00 CHADT 1
+wanted=Monday 00:00:00
+
+TZ=America/Lima - wrong day.
+tStamp=Thursday 1985-12-26 17:17:17 PET 0
+result=Thursday 1986-01-02 00:00:00 PEST 1
+wanted=Thursday 00:00:00
+
+TZ=Asia/Karachi - wrong day.
+tStamp=Friday 2002-04-05 17:17:17 PKT 0
+result=Friday 2002-04-12 00:00:00 PKST 1
+wanted=Friday 00:00:00
+
+TZ=America/Asuncion - wrong day.
+tStamp=Wednesday 2002-02-27 17:17:17 PYST 1
+result=Wednesday 2002-03-06 00:00:00 PYST 1
+wanted=Wednesday 00:00:00
+
+TZ=Asia/Singapore - wrong day.
+tStamp=Thursday 1981-12-31 17:17:17 SGT 0
+result=Thursday 1982-01-07 00:00:00 SGT 0
+wanted=Thursday 00:00:00
+
+TZ=America/Montevideo - wrong day.
+tStamp=Thursday 2004-09-16 17:17:17 UYT 0
+result=Thursday 2004-09-23 00:00:00 UYST 1
+wanted=Thursday 00:00:00
diff --git a/ext/date/tests/bug33414-2.phpt b/ext/date/tests/bug33414-2.phpt
new file mode 100644
index 0000000..51cbe3b
--- /dev/null
+++ b/ext/date/tests/bug33414-2.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Bug #33414 [2] (Comprehensive list of incorrect days returned after strotime() / date() tests)
+--FILE--
+<?php
+print "TZ=Pacific/Rarotonga - wrong day.\n";
+date_default_timezone_set("Pacific/Rarotonga");
+$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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:00:00\n\n";
+
+print "TZ=Atlantic/South_Georgia - wrong day.\n";
+date_default_timezone_set("Atlantic/South_Georgia");
+$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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:00:00\n\n";
+
+print "TZ=America/Port-au-Prince - wrong day.\n";
+date_default_timezone_set("America/Port-au-Prince");
+$tStamp = mktime (17, 17, 17, 1, 12871, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:00:00\n\n";
+
+print "TZ=Pacific/Enderbury - wrong day, off by 2 days.\n";
+date_default_timezone_set("Pacific/Enderbury");
+$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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:00:00\n\n";
+
+print "TZ=Pacific/Kiritimati - wrong day, off by 2 days.\n";
+date_default_timezone_set("Pacific/Kiritimati");
+$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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:00:00\n\n";
+
+print "TZ=America/Managua - wrong day.\n";
+date_default_timezone_set("America/Managua");
+$tStamp = mktime (17, 17, 17, 1, 12879, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:00:00\n\n";
+
+print "TZ=Pacific/Pitcairn - wrong day.\n";
+date_default_timezone_set("Pacific/Pitcairn");
+$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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Wednesday 00:00:00\n\n";
+
+print "TZ=Pacific/Fakaofo - wrong day.\n";
+date_default_timezone_set("Pacific/Fakaofo");
+$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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Saturday 00:00:00\n\n";
+
+print "TZ=Pacific/Johnston - wrong day.\n";
+date_default_timezone_set("Pacific/Johnston");
+$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 Friday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Friday 00:00:00\n\n";
+?>
+--EXPECT--
+TZ=Pacific/Rarotonga - wrong day.
+tStamp=Thursday 1970-01-01 17:17:17 CKT 0
+result=Tuesday 1970-01-06 00:00:00 CKT 0
+wanted=Tuesday 00:00:00
+
+TZ=Atlantic/South_Georgia - wrong day.
+tStamp=Thursday 1970-01-01 17:17:17 GST 0
+result=Tuesday 1970-01-06 00:00:00 GST 0
+wanted=Tuesday 00:00:00
+
+TZ=America/Port-au-Prince - wrong day.
+tStamp=Monday 2005-03-28 17:17:17 EST 0
+result=Monday 2005-04-04 00:00:00 EDT 1
+wanted=Monday 00:00:00
+
+TZ=Pacific/Enderbury - wrong day, off by 2 days.
+tStamp=Thursday 1970-01-01 17:17:17 PHOT 0
+result=Monday 1970-01-05 00:00:00 PHOT 0
+wanted=Monday 00:00:00
+
+TZ=Pacific/Kiritimati - wrong day, off by 2 days.
+tStamp=Thursday 1970-01-01 17:17:17 LINT 0
+result=Monday 1970-01-05 00:00:00 LINT 0
+wanted=Monday 00:00:00
+
+TZ=America/Managua - wrong day.
+tStamp=Tuesday 2005-04-05 17:17:17 CST 0
+result=Tuesday 2005-04-12 00:00:00 CDT 1
+wanted=Tuesday 00:00:00
+
+TZ=Pacific/Pitcairn - wrong day.
+tStamp=Thursday 1970-01-01 17:17:17 PNT 0
+result=Wednesday 1970-01-07 00:00:00 PNT 0
+wanted=Wednesday 00:00:00
+
+TZ=Pacific/Fakaofo - wrong day.
+tStamp=Thursday 1970-01-01 17:17:17 TKT 0
+result=Saturday 1970-01-03 00:00:00 TKT 0
+wanted=Saturday 00:00:00
+
+TZ=Pacific/Johnston - wrong day.
+tStamp=Thursday 1970-01-01 17:17:17 HST 0
+result=Friday 1970-01-02 00:00:00 HST 0
+wanted=Friday 00:00:00
diff --git a/ext/date/tests/bug33415-1.phpt b/ext/date/tests/bug33415-1.phpt
new file mode 100644
index 0000000..698252a
--- /dev/null
+++ b/ext/date/tests/bug33415-1.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #33415 [1] (Possibly invalid non-one-hour DST or timezone shifts)
+--FILE--
+<?php
+
+print "TZ=America/Jujuy - Is it OK for this to be 2 AM, rather than 1
+AM as per most DST transitions?\n";
+date_default_timezone_set("America/Jujuy");
+$tStamp = mktime (17, 17, 17, 1, 7593, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:00:00\n\n";
+
+print "TZ=Asia/Tbilisi - Is it OK for this to be 2 AM?\n";
+date_default_timezone_set("Asia/Tbilisi");
+$tStamp = mktime (17, 17, 17, 1, 12863, 1970);
+print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 00:00:00\n\n";
+?>
+--EXPECT--
+TZ=America/Jujuy - Is it OK for this to be 2 AM, rather than 1
+AM as per most DST transitions?
+tStamp=Monday 1990-10-15 17:17:17 WART 0
+result=Monday 1990-10-22 00:00:00 WART 0
+wanted=Monday 00:00:00
+
+TZ=Asia/Tbilisi - Is it OK for this to be 2 AM?
+tStamp=Sunday 2005-03-20 17:17:17 GET 0
+result=Sunday 2005-03-27 00:00:00 GET 0
+wanted=Sunday 00:00:00
diff --git a/ext/date/tests/bug33415-2.phpt b/ext/date/tests/bug33415-2.phpt
new file mode 100644
index 0000000..424be76
--- /dev/null
+++ b/ext/date/tests/bug33415-2.phpt
@@ -0,0 +1,342 @@
+--TEST--
+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";
+$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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Wednesday 00:00:00\n\n";
+
+print "TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:30:00\n\n";
+
+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";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+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";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Saturday 00:00:00\n\n";
+
+print "TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 03:00:00\n\n";
+
+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";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+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";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 00:30:00\n\n";
+
+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";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:00:00\n\n";
+
+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";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:00:00\n\n";
+
+print "TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 02:00:00\n\n";
+
+print "TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:45:00\n\n";
+
+print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:30:00\n\n";
+
+print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
+not appear to have a DST or timezone transition.\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+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";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:44:30\n\n";
+
+print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Wednesday 00:15:00\n\n";
+
+print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:30:00\n\n";
+
+print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Sunday 00:30:00\n\n";
+
+print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
+or timezone transition.\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 00:00:00\n\n";
+
+print "TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Thursday 01:00:00\n\n";
+
+print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
+timezone transition.\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Saturday 00:00:00\n\n";
+
+print "TZ=Pacific/Funafuti - Is it OK for this to be midday? Note: does
+not appear to have a DST or timezone transition.\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Wednesday 00:00:00\n\n";
+
+print "TZ=Pacific/Wake - Is it OK for this to be midday? Note: does not
+appear to have a DST or timezone transition.\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:00:00\n\n";
+
+print "TZ=Pacific/Wallis - Is it OK for this to be midday? Note: does
+not appear to have a DST or timezone transition.\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Tuesday 00:00:00\n\n";
+
+print "TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes\n";
+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);
+print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
+print "wanted=Monday 00:30:00\n\n";
+
+?>
+--EXPECT--
+TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to
+have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 CAT 0
+result=Wednesday 1970-01-07 00:00:00 CAT 0
+wanted=Wednesday 00:00:00
+
+TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes
+tStamp=Thursday 1987-09-24 17:17:17 IST 0
+result=Thursday 1987-10-01 00:30:00 BTT 0
+wanted=Thursday 00:30:00
+
+TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not
+appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 CCT 0
+result=Thursday 1970-01-08 00:00:00 CCT 0
+wanted=Thursday 00:00:00
+
+TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does
+not appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 CAT 0
+result=Saturday 1970-01-03 00:00:00 CAT 0
+wanted=Saturday 00:00:00
+
+TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes
+tStamp=Thursday 1980-04-24 17:17:17 KAST 0
+result=Thursday 1980-05-01 03:00:00 CST 0
+wanted=Thursday 03:00:00
+
+TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does
+not appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 CXT 0
+result=Sunday 1970-01-04 00:00:00 CXT 0
+wanted=Sunday 00:00:00
+
+TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes
+tStamp=Sunday 1970-10-18 17:17:17 EST 0
+result=Sunday 1970-10-25 00:30:00 EHDT 1
+wanted=Sunday 00:30:00
+
+TZ=Pacific/Truk - Is it OK for this to be 10 AM? Note: does not
+appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 CHUT 0
+result=Tuesday 1970-01-06 00:00:00 CHUT 0
+wanted=Tuesday 00:00:00
+
+TZ=Pacific/Ponape - Is it OK for this to be 11 AM? Note: does
+not appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 PONT 0
+result=Monday 1970-01-05 00:00:00 PONT 0
+wanted=Monday 00:00:00
+
+TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes
+tStamp=Sunday 1981-03-22 17:17:17 CGT 0
+result=Sunday 1981-03-29 02:00:00 EGST 1
+wanted=Sunday 02:00:00
+
+TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes
+tStamp=Thursday 1975-07-24 17:17:17 GYT 0
+result=Thursday 1975-07-31 00:45:00 GYT 0
+wanted=Thursday 00:45:00
+
+TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes
+tStamp=Tuesday 1977-10-25 17:17:17 IRST 0
+result=Tuesday 1977-11-01 00:30:00 IRST 0
+wanted=Tuesday 00:30:00
+
+TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
+not appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 GILT 0
+result=Monday 1970-01-05 00:00:00 GILT 0
+wanted=Monday 00:00:00
+
+TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes
+tStamp=Monday 1972-04-24 17:17:17 LRT 0
+result=Monday 1972-05-01 00:44:30 GMT 0
+wanted=Monday 00:44:30
+
+TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes
+tStamp=Wednesday 1985-12-25 17:17:17 IST 0
+result=Wednesday 1986-01-01 00:15:00 NPT 0
+wanted=Wednesday 00:15:00
+
+TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes
+tStamp=Tuesday 1979-04-24 17:17:17 NRT 0
+result=Tuesday 1979-05-01 00:30:00 NRT 0
+wanted=Tuesday 00:30:00
+
+TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes
+tStamp=Sunday 1978-09-24 17:17:17 NUT 0
+result=Sunday 1978-10-01 00:30:00 NUT 0
+wanted=Sunday 00:30:00
+
+TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
+or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 PGT 0
+result=Thursday 1970-01-08 00:00:00 PGT 0
+wanted=Thursday 00:00:00
+
+TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes
+tStamp=Thursday 1980-04-24 17:17:17 AST 0
+result=Thursday 1980-05-01 01:00:00 PMST 0
+wanted=Thursday 01:00:00
+
+TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
+timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 PWT 0
+result=Saturday 1970-01-03 00:00:00 PWT 0
+wanted=Saturday 00:00:00
+
+TZ=Pacific/Funafuti - Is it OK for this to be midday? Note: does
+not appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 TVT 0
+result=Wednesday 1970-01-07 00:00:00 TVT 0
+wanted=Wednesday 00:00:00
+
+TZ=Pacific/Wake - Is it OK for this to be midday? Note: does not
+appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 WAKT 0
+result=Tuesday 1970-01-06 00:00:00 WAKT 0
+wanted=Tuesday 00:00:00
+
+TZ=Pacific/Wallis - Is it OK for this to be midday? Note: does
+not appear to have a DST or timezone transition.
+tStamp=Thursday 1970-01-01 17:17:17 WFT 0
+result=Tuesday 1970-01-06 00:00:00 WFT 0
+wanted=Tuesday 00:00:00
+
+TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes
+tStamp=Monday 1984-09-24 17:17:17 SRT 0
+result=Monday 1984-10-01 00:30:00 SRT 0
+wanted=Monday 00:30:00
diff --git a/ext/date/tests/bug33452.phpt b/ext/date/tests/bug33452.phpt
new file mode 100644
index 0000000..e5abebf
--- /dev/null
+++ b/ext/date/tests/bug33452.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #33452 (Support for year accompanying ISO week nr)
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+echo date('Y-W', strtotime('2005-1-1')), "\n";
+echo date('o-W', strtotime('2005-1-1')), "\n";
+?>
+--EXPECT--
+2005-53
+2004-53
diff --git a/ext/date/tests/bug33532.phpt b/ext/date/tests/bug33532.phpt
new file mode 100644
index 0000000..1486308
--- /dev/null
+++ b/ext/date/tests/bug33532.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Bug #33532 (Different output for strftime() and date())
+--INI--
+error_reporting=2047
+date.timezone=UTC
+--SKIPIF--
+<?php
+if(PHP_OS == 'Darwin' || defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip strftime uses system TZ on Darwin and Windows");
+?>
+--FILE--
+<?php
+
+setlocale(LC_ALL, 'C');
+
+print "TZ has NOT been set\n";
+print "Should strftime==datestr? Strftime seems to assume GMT tStamp.\n";
+$input = "10:00:00 AM July 1 2005";
+print "input " . $input . "\n";
+$tStamp = strtotime($input);
+print "strftime " . strftime("%r %B%e %Y %Z %z", $tStamp) . "\n";
+print "datestr " . date ("H:i:s A F j Y T", $tStamp) . "\n";
+
+print "\nSetting TZ\n";
+date_default_timezone_set('Australia/Sydney');
+putenv("TZ=Australia/Sydney");
+$input = "10:00:00 AM July 1 2005";
+print "input " . $input . "\n";
+$tStamp = strtotime($input);
+print "strftime " . strftime("%r %B%e %Y %Z %z", $tStamp) . "\n";
+print "datestr " . date ("H:i:s A F j Y T", $tStamp) . "\n";
+
+?>
+--EXPECT--
+TZ has NOT been set
+Should strftime==datestr? Strftime seems to assume GMT tStamp.
+input 10:00:00 AM July 1 2005
+strftime 10:00:00 AM July 1 2005 UTC +0000
+datestr 10:00:00 AM July 1 2005 UTC
+
+Setting TZ
+input 10:00:00 AM July 1 2005
+strftime 10:00:00 AM July 1 2005 EST +1000
+datestr 10:00:00 AM July 1 2005 EST
diff --git a/ext/date/tests/bug33536.phpt b/ext/date/tests/bug33536.phpt
new file mode 100644
index 0000000..aa5f5dd
--- /dev/null
+++ b/ext/date/tests/bug33536.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #33456 (strtotime defaults to now even on non time string)
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+var_dump(strtotime("monkey"));
+print date("Y-m-d", strtotime("monkey")) ."\n";
+print date("Y-m-d", false) ."\n";
+?>
+--EXPECT--
+bool(false)
+1970-01-01
+1970-01-01
diff --git a/ext/date/tests/bug33562.phpt b/ext/date/tests/bug33562.phpt
new file mode 100644
index 0000000..8383a79
--- /dev/null
+++ b/ext/date/tests/bug33562.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #33562 (date("") crashes)
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+echo "[", date(""), "]\n";
+echo "done";
+?>
+--EXPECT--
+[]
+done
diff --git a/ext/date/tests/bug33563.phpt b/ext/date/tests/bug33563.phpt
new file mode 100644
index 0000000..9f4eb7b
--- /dev/null
+++ b/ext/date/tests/bug33563.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #33563 (strtotime('+1 month',$abc) cant get right time)
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+$strCurrDate = date('Y-m-d H:i:s',strtotime('2005-06-30 21:04:23'));
+$strMonAfter = date('Y-m-d H:i:s',strtotime('+1 month',strtotime($strCurrDate)));
+
+echo "strCurrDate:$strCurrDate strMonAfter:$strMonAfter";
+?>
+--EXPECT--
+strCurrDate:2005-06-30 21:04:23 strMonAfter:2005-07-30 21:04:23
diff --git a/ext/date/tests/bug33578.phpt b/ext/date/tests/bug33578.phpt
new file mode 100644
index 0000000..4ba6df8
--- /dev/null
+++ b/ext/date/tests/bug33578.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #33578 (strtotime() doesn't parse "11 Oct" format")
+--FILE--
+<?php
+ date_default_timezone_set("UTC");
+ echo date('m/d/Y', strtotime('Oct 11')), "\n";
+ echo date('m/d/Y', strtotime('11 Oct')), "\n";
+ echo date('m/d/Y', strtotime('11 Oct 2005')), "\n";
+ echo date('m/d/Y', strtotime('Oct11')), "\n";
+ echo date('m/d/Y', strtotime('11Oct')), "\n";
+ echo date('m/d/Y', strtotime('11Oct 2005')), "\n";
+ echo date('m/d/Y', strtotime('11Oct2005')), "\n";
+?>
+--EXPECTF--
+10/11/%d
+10/11/%d
+10/11/2005
+10/11/%d
+10/11/%d
+10/11/2005
+10/11/2005
diff --git a/ext/date/tests/bug33869.phpt b/ext/date/tests/bug33869.phpt
new file mode 100644
index 0000000..6957a6b
--- /dev/null
+++ b/ext/date/tests/bug33869.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #33869 (strtotime() doesn't parse "+1days" format)
+--FILE--
+<?php
+ date_default_timezone_set("UTC");
+ $tm = strtotime("2005-01-01 01:01:01");
+ echo date(DATE_ISO8601, strtotime('+5days', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+1month', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+1year', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+5 days', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+1 month', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+1 year', $tm));
+ echo "\n";
+?>
+--EXPECT--
+2005-01-06T01:01:01+0000
+2005-02-01T01:01:01+0000
+2006-01-01T01:01:01+0000
+2005-01-06T01:01:01+0000
+2005-02-01T01:01:01+0000
+2006-01-01T01:01:01+0000
diff --git a/ext/date/tests/bug33957.phpt b/ext/date/tests/bug33957.phpt
new file mode 100644
index 0000000..43f14ee
--- /dev/null
+++ b/ext/date/tests/bug33957.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+for ($i = 14; $i <= 31; $i++) {
+ echo "1992-12-$i ", date("W", strtotime("1992-12-$i")), "\n";
+}
+for ($i = 1; $i <= 8; $i++) {
+ echo "1993-01-$i ", date("W", strtotime("1993-01-$i")), "\n";
+}
+echo "----\n";
+echo " ";
+foreach (range(1992, 2019) as $year) {
+ echo "$year ";
+}
+echo "\n";
+
+for ($i = 14; $i <= 31; $i++) {
+ echo " (12-$i) ";
+ foreach (range(1992, 2019) as $year) {
+ echo sprintf(" %02d-", date("W", strtotime("$year-12-$i")));
+ echo sprintf("%04d ", date("o", strtotime("$year-12-$i")));
+ }
+ echo "\n";
+}
+for ($i = 1; $i <= 18; $i++) {
+ printf("+1 (01-%02d) ", $i);
+ foreach (range(1993, 2020) as $year) {
+ echo sprintf(" %02d-", date("W", strtotime("$year-1-$i")));
+ echo sprintf("%04d ", date("o", strtotime("$year-1-$i")));
+ }
+ echo "\n";
+}
+echo "----\n";
+?>
+--EXPECT--
+1992-12-14 51
+1992-12-15 51
+1992-12-16 51
+1992-12-17 51
+1992-12-18 51
+1992-12-19 51
+1992-12-20 51
+1992-12-21 52
+1992-12-22 52
+1992-12-23 52
+1992-12-24 52
+1992-12-25 52
+1992-12-26 52
+1992-12-27 52
+1992-12-28 53
+1992-12-29 53
+1992-12-30 53
+1992-12-31 53
+1993-01-1 53
+1993-01-2 53
+1993-01-3 53
+1993-01-4 01
+1993-01-5 01
+1993-01-6 01
+1993-01-7 01
+1993-01-8 01
+----
+ 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
+ (12-14) 51-1992 50-1993 50-1994 50-1995 50-1996 50-1997 51-1998 50-1999 50-2000 50-2001 50-2002 50-2003 51-2004 50-2005 50-2006 50-2007 50-2008 51-2009 50-2010 50-2011 50-2012 50-2013 50-2014 51-2015 50-2016 50-2017 50-2018 50-2019
+ (12-15) 51-1992 50-1993 50-1994 50-1995 50-1996 51-1997 51-1998 50-1999 50-2000 50-2001 50-2002 51-2003 51-2004 50-2005 50-2006 50-2007 51-2008 51-2009 50-2010 50-2011 50-2012 50-2013 51-2014 51-2015 50-2016 50-2017 50-2018 50-2019
+ (12-16) 51-1992 50-1993 50-1994 50-1995 51-1996 51-1997 51-1998 50-1999 50-2000 50-2001 51-2002 51-2003 51-2004 50-2005 50-2006 50-2007 51-2008 51-2009 50-2010 50-2011 50-2012 51-2013 51-2014 51-2015 50-2016 50-2017 50-2018 51-2019
+ (12-17) 51-1992 50-1993 50-1994 50-1995 51-1996 51-1997 51-1998 50-1999 50-2000 51-2001 51-2002 51-2003 51-2004 50-2005 50-2006 51-2007 51-2008 51-2009 50-2010 50-2011 51-2012 51-2013 51-2014 51-2015 50-2016 50-2017 51-2018 51-2019
+ (12-18) 51-1992 50-1993 50-1994 51-1995 51-1996 51-1997 51-1998 50-1999 51-2000 51-2001 51-2002 51-2003 51-2004 50-2005 51-2006 51-2007 51-2008 51-2009 50-2010 50-2011 51-2012 51-2013 51-2014 51-2015 50-2016 51-2017 51-2018 51-2019
+ (12-19) 51-1992 50-1993 51-1994 51-1995 51-1996 51-1997 51-1998 50-1999 51-2000 51-2001 51-2002 51-2003 51-2004 51-2005 51-2006 51-2007 51-2008 51-2009 50-2010 51-2011 51-2012 51-2013 51-2014 51-2015 51-2016 51-2017 51-2018 51-2019
+ (12-20) 51-1992 51-1993 51-1994 51-1995 51-1996 51-1997 51-1998 51-1999 51-2000 51-2001 51-2002 51-2003 52-2004 51-2005 51-2006 51-2007 51-2008 51-2009 51-2010 51-2011 51-2012 51-2013 51-2014 51-2015 51-2016 51-2017 51-2018 51-2019
+ (12-21) 52-1992 51-1993 51-1994 51-1995 51-1996 51-1997 52-1998 51-1999 51-2000 51-2001 51-2002 51-2003 52-2004 51-2005 51-2006 51-2007 51-2008 52-2009 51-2010 51-2011 51-2012 51-2013 51-2014 52-2015 51-2016 51-2017 51-2018 51-2019
+ (12-22) 52-1992 51-1993 51-1994 51-1995 51-1996 52-1997 52-1998 51-1999 51-2000 51-2001 51-2002 52-2003 52-2004 51-2005 51-2006 51-2007 52-2008 52-2009 51-2010 51-2011 51-2012 51-2013 52-2014 52-2015 51-2016 51-2017 51-2018 51-2019
+ (12-23) 52-1992 51-1993 51-1994 51-1995 52-1996 52-1997 52-1998 51-1999 51-2000 51-2001 52-2002 52-2003 52-2004 51-2005 51-2006 51-2007 52-2008 52-2009 51-2010 51-2011 51-2012 52-2013 52-2014 52-2015 51-2016 51-2017 51-2018 52-2019
+ (12-24) 52-1992 51-1993 51-1994 51-1995 52-1996 52-1997 52-1998 51-1999 51-2000 52-2001 52-2002 52-2003 52-2004 51-2005 51-2006 52-2007 52-2008 52-2009 51-2010 51-2011 52-2012 52-2013 52-2014 52-2015 51-2016 51-2017 52-2018 52-2019
+ (12-25) 52-1992 51-1993 51-1994 52-1995 52-1996 52-1997 52-1998 51-1999 52-2000 52-2001 52-2002 52-2003 52-2004 51-2005 52-2006 52-2007 52-2008 52-2009 51-2010 51-2011 52-2012 52-2013 52-2014 52-2015 51-2016 52-2017 52-2018 52-2019
+ (12-26) 52-1992 51-1993 52-1994 52-1995 52-1996 52-1997 52-1998 51-1999 52-2000 52-2001 52-2002 52-2003 52-2004 52-2005 52-2006 52-2007 52-2008 52-2009 51-2010 52-2011 52-2012 52-2013 52-2014 52-2015 52-2016 52-2017 52-2018 52-2019
+ (12-27) 52-1992 52-1993 52-1994 52-1995 52-1996 52-1997 52-1998 52-1999 52-2000 52-2001 52-2002 52-2003 53-2004 52-2005 52-2006 52-2007 52-2008 52-2009 52-2010 52-2011 52-2012 52-2013 52-2014 52-2015 52-2016 52-2017 52-2018 52-2019
+ (12-28) 53-1992 52-1993 52-1994 52-1995 52-1996 52-1997 53-1998 52-1999 52-2000 52-2001 52-2002 52-2003 53-2004 52-2005 52-2006 52-2007 52-2008 53-2009 52-2010 52-2011 52-2012 52-2013 52-2014 53-2015 52-2016 52-2017 52-2018 52-2019
+ (12-29) 53-1992 52-1993 52-1994 52-1995 52-1996 01-1998 53-1998 52-1999 52-2000 52-2001 52-2002 01-2004 53-2004 52-2005 52-2006 52-2007 01-2009 53-2009 52-2010 52-2011 52-2012 52-2013 01-2015 53-2015 52-2016 52-2017 52-2018 52-2019
+ (12-30) 53-1992 52-1993 52-1994 52-1995 01-1997 01-1998 53-1998 52-1999 52-2000 52-2001 01-2003 01-2004 53-2004 52-2005 52-2006 52-2007 01-2009 53-2009 52-2010 52-2011 52-2012 01-2014 01-2015 53-2015 52-2016 52-2017 52-2018 01-2020
+ (12-31) 53-1992 52-1993 52-1994 52-1995 01-1997 01-1998 53-1998 52-1999 52-2000 01-2002 01-2003 01-2004 53-2004 52-2005 52-2006 01-2008 01-2009 53-2009 52-2010 52-2011 01-2013 01-2014 01-2015 53-2015 52-2016 52-2017 01-2019 01-2020
++1 (01-01) 53-1992 52-1993 52-1994 01-1996 01-1997 01-1998 53-1998 52-1999 01-2001 01-2002 01-2003 01-2004 53-2004 52-2005 01-2007 01-2008 01-2009 53-2009 52-2010 52-2011 01-2013 01-2014 01-2015 53-2015 52-2016 01-2018 01-2019 01-2020
++1 (01-02) 53-1992 52-1993 01-1995 01-1996 01-1997 01-1998 53-1998 52-1999 01-2001 01-2002 01-2003 01-2004 53-2004 01-2006 01-2007 01-2008 01-2009 53-2009 52-2010 01-2012 01-2013 01-2014 01-2015 53-2015 01-2017 01-2018 01-2019 01-2020
++1 (01-03) 53-1992 01-1994 01-1995 01-1996 01-1997 01-1998 53-1998 01-2000 01-2001 01-2002 01-2003 01-2004 01-2005 01-2006 01-2007 01-2008 01-2009 53-2009 01-2011 01-2012 01-2013 01-2014 01-2015 53-2015 01-2017 01-2018 01-2019 01-2020
++1 (01-04) 01-1993 01-1994 01-1995 01-1996 01-1997 01-1998 01-1999 01-2000 01-2001 01-2002 01-2003 01-2004 01-2005 01-2006 01-2007 01-2008 01-2009 01-2010 01-2011 01-2012 01-2013 01-2014 01-2015 01-2016 01-2017 01-2018 01-2019 01-2020
++1 (01-05) 01-1993 01-1994 01-1995 01-1996 01-1997 02-1998 01-1999 01-2000 01-2001 01-2002 01-2003 02-2004 01-2005 01-2006 01-2007 01-2008 02-2009 01-2010 01-2011 01-2012 01-2013 01-2014 02-2015 01-2016 01-2017 01-2018 01-2019 01-2020
++1 (01-06) 01-1993 01-1994 01-1995 01-1996 02-1997 02-1998 01-1999 01-2000 01-2001 01-2002 02-2003 02-2004 01-2005 01-2006 01-2007 01-2008 02-2009 01-2010 01-2011 01-2012 01-2013 02-2014 02-2015 01-2016 01-2017 01-2018 01-2019 02-2020
++1 (01-07) 01-1993 01-1994 01-1995 01-1996 02-1997 02-1998 01-1999 01-2000 01-2001 02-2002 02-2003 02-2004 01-2005 01-2006 01-2007 02-2008 02-2009 01-2010 01-2011 01-2012 02-2013 02-2014 02-2015 01-2016 01-2017 01-2018 02-2019 02-2020
++1 (01-08) 01-1993 01-1994 01-1995 02-1996 02-1997 02-1998 01-1999 01-2000 02-2001 02-2002 02-2003 02-2004 01-2005 01-2006 02-2007 02-2008 02-2009 01-2010 01-2011 01-2012 02-2013 02-2014 02-2015 01-2016 01-2017 02-2018 02-2019 02-2020
++1 (01-09) 01-1993 01-1994 02-1995 02-1996 02-1997 02-1998 01-1999 01-2000 02-2001 02-2002 02-2003 02-2004 01-2005 02-2006 02-2007 02-2008 02-2009 01-2010 01-2011 02-2012 02-2013 02-2014 02-2015 01-2016 02-2017 02-2018 02-2019 02-2020
++1 (01-10) 01-1993 02-1994 02-1995 02-1996 02-1997 02-1998 01-1999 02-2000 02-2001 02-2002 02-2003 02-2004 02-2005 02-2006 02-2007 02-2008 02-2009 01-2010 02-2011 02-2012 02-2013 02-2014 02-2015 01-2016 02-2017 02-2018 02-2019 02-2020
++1 (01-11) 02-1993 02-1994 02-1995 02-1996 02-1997 02-1998 02-1999 02-2000 02-2001 02-2002 02-2003 02-2004 02-2005 02-2006 02-2007 02-2008 02-2009 02-2010 02-2011 02-2012 02-2013 02-2014 02-2015 02-2016 02-2017 02-2018 02-2019 02-2020
++1 (01-12) 02-1993 02-1994 02-1995 02-1996 02-1997 03-1998 02-1999 02-2000 02-2001 02-2002 02-2003 03-2004 02-2005 02-2006 02-2007 02-2008 03-2009 02-2010 02-2011 02-2012 02-2013 02-2014 03-2015 02-2016 02-2017 02-2018 02-2019 02-2020
++1 (01-13) 02-1993 02-1994 02-1995 02-1996 03-1997 03-1998 02-1999 02-2000 02-2001 02-2002 03-2003 03-2004 02-2005 02-2006 02-2007 02-2008 03-2009 02-2010 02-2011 02-2012 02-2013 03-2014 03-2015 02-2016 02-2017 02-2018 02-2019 03-2020
++1 (01-14) 02-1993 02-1994 02-1995 02-1996 03-1997 03-1998 02-1999 02-2000 02-2001 03-2002 03-2003 03-2004 02-2005 02-2006 02-2007 03-2008 03-2009 02-2010 02-2011 02-2012 03-2013 03-2014 03-2015 02-2016 02-2017 02-2018 03-2019 03-2020
++1 (01-15) 02-1993 02-1994 02-1995 03-1996 03-1997 03-1998 02-1999 02-2000 03-2001 03-2002 03-2003 03-2004 02-2005 02-2006 03-2007 03-2008 03-2009 02-2010 02-2011 02-2012 03-2013 03-2014 03-2015 02-2016 02-2017 03-2018 03-2019 03-2020
++1 (01-16) 02-1993 02-1994 03-1995 03-1996 03-1997 03-1998 02-1999 02-2000 03-2001 03-2002 03-2003 03-2004 02-2005 03-2006 03-2007 03-2008 03-2009 02-2010 02-2011 03-2012 03-2013 03-2014 03-2015 02-2016 03-2017 03-2018 03-2019 03-2020
++1 (01-17) 02-1993 03-1994 03-1995 03-1996 03-1997 03-1998 02-1999 03-2000 03-2001 03-2002 03-2003 03-2004 03-2005 03-2006 03-2007 03-2008 03-2009 02-2010 03-2011 03-2012 03-2013 03-2014 03-2015 02-2016 03-2017 03-2018 03-2019 03-2020
++1 (01-18) 03-1993 03-1994 03-1995 03-1996 03-1997 03-1998 03-1999 03-2000 03-2001 03-2002 03-2003 03-2004 03-2005 03-2006 03-2007 03-2008 03-2009 03-2010 03-2011 03-2012 03-2013 03-2014 03-2015 03-2016 03-2017 03-2018 03-2019 03-2020
+----
diff --git a/ext/date/tests/bug34087.phpt b/ext/date/tests/bug34087.phpt
new file mode 100644
index 0000000..3fa3885
--- /dev/null
+++ b/ext/date/tests/bug34087.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #34087 (strtotime() does not work with date format "Y/m/d")
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+echo "Y/m/d: ", strtotime("2005/8/12"), "\n";
+echo "Y-m-d: ", strtotime("2005-8-12"), "\n";
+
+echo date(DATE_ISO8601, strtotime("2005/1/2")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/01/02")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/01/2")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/1/02")), "\n";
+?>
+--EXPECT--
+Y/m/d: 1123804800
+Y-m-d: 1123804800
+2005-01-02T00:00:00+0000
+2005-01-02T00:00:00+0000
+2005-01-02T00:00:00+0000
+2005-01-02T00:00:00+0000
diff --git a/ext/date/tests/bug34304.phpt b/ext/date/tests/bug34304.phpt
new file mode 100644
index 0000000..88030b7
--- /dev/null
+++ b/ext/date/tests/bug34304.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #34304 (date('w') returns wrong number for sunday, 'N' modifier is missing)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+echo date('o\-\WW\-N', strtotime('2 January 2005')), "\n";
+echo date('o\-\WW\-N', strtotime('9 January 2005')), "\n";
+?>
+--EXPECT--
+2004-W53-7
+2005-W01-7
diff --git a/ext/date/tests/bug34676.phpt b/ext/date/tests/bug34676.phpt
new file mode 100644
index 0000000..6f616fe
--- /dev/null
+++ b/ext/date/tests/bug34676.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #34676 (missing support for strtotime("midnight") and strtotime("noon"))
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$tests = array(
+ 'noon', 'midnight'
+);
+
+foreach ($tests as $test) {
+ $t = strtotime("2005-12-22 ". $test);
+ printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
+}
+
+?>
+--EXPECT--
+noon => 2005-12-22T12:00:00+0000
+midnight => 2005-12-22T00:00:00+0000
diff --git a/ext/date/tests/bug34771.phpt b/ext/date/tests/bug34771.phpt
new file mode 100644
index 0000000..a27d085
--- /dev/null
+++ b/ext/date/tests/bug34771.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #34771 (strtotime() fails with 1-12am/pm)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$tests = array(
+ '12am', '1am', '1pm',
+ '12a.m.', '1a.m.', '1p.m.',
+ '12:00am', '1:00am', '1:00pm',
+ '12:00a.m.', '1:00a.m.', '1:00p.m.'
+);
+
+foreach ($tests as $test) {
+ $t = strtotime("2005-12-22 ". $test);
+ printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
+}
+
+?>
+--EXPECT--
+12am => 2005-12-22T00:00:00+0000
+1am => 2005-12-22T01:00:00+0000
+1pm => 2005-12-22T13:00:00+0000
+12a.m. => 2005-12-22T00:00:00+0000
+1a.m. => 2005-12-22T01:00:00+0000
+1p.m. => 2005-12-22T13:00:00+0000
+12:00am => 2005-12-22T00:00:00+0000
+1:00am => 2005-12-22T01:00:00+0000
+1:00pm => 2005-12-22T13:00:00+0000
+12:00a.m. => 2005-12-22T00:00:00+0000
+1:00a.m. => 2005-12-22T01:00:00+0000
+1:00p.m. => 2005-12-22T13:00:00+0000
diff --git a/ext/date/tests/bug35143.phpt b/ext/date/tests/bug35143.phpt
new file mode 100644
index 0000000..02b0072
--- /dev/null
+++ b/ext/date/tests/bug35143.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #35143 (gettimeofday() ignores current time zone)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+var_dump(date_default_timezone_get());
+var_dump(gettimeofday());
+?>
+--EXPECTF--
+string(3) "UTC"
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(0)
+ ["dsttime"]=>
+ int(0)
+}
diff --git a/ext/date/tests/bug35218.phpt b/ext/date/tests/bug35218.phpt
new file mode 100644
index 0000000..725f03c
--- /dev/null
+++ b/ext/date/tests/bug35218.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #35218 (strtotime no longer ignores timezone comments like "(PST)")
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+$date = 'Sun, 13 Nov 2005 22:56:10 -0800 (PST)';
+$date_fixed = 'Sun, 13 Nov 2005 22:56:10 -0800';
+
+var_dump(strtotime($date));
+var_dump(strtotime($date_fixed));
+?>
+--EXPECT--
+int(1131951370)
+int(1131951370)
diff --git a/ext/date/tests/bug35414.phpt b/ext/date/tests/bug35414.phpt
new file mode 100644
index 0000000..f6af511
--- /dev/null
+++ b/ext/date/tests/bug35414.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #35414 (strtotime() no longer works with ordinal suffix)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date(DATE_ISO8601, strtotime("Sat 26th Nov 2005 18:18")) . "\n";
+echo date(DATE_ISO8601, strtotime("26th Nov", 1134340285)) . "\n";
+echo date(DATE_ISO8601, strtotime("Dec. 4th, 2005")) . "\n";
+echo date(DATE_ISO8601, strtotime("December 4th, 2005")) . "\n";
+?>
+--EXPECT--
+2005-11-26T18:18:00+0000
+2005-11-26T00:00:00+0000
+2005-12-04T00:00:00+0000
+2005-12-04T00:00:00+0000
diff --git a/ext/date/tests/bug35422.phpt b/ext/date/tests/bug35422.phpt
new file mode 100644
index 0000000..8273c75
--- /dev/null
+++ b/ext/date/tests/bug35422.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #35422 (strtotime() does not parse times with UTC as timezone)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date(DATE_ISO8601, strtotime("July 1, 2000 00:00:00 UTC")) . "\n";
+echo date(DATE_ISO8601, strtotime("July 1, 2000 00:00:00 GMT")) . "\n";
+?>
+--EXPECT--
+2000-07-01T00:00:00+0000
+2000-07-01T00:00:00+0000
diff --git a/ext/date/tests/bug35425.phpt b/ext/date/tests/bug35425.phpt
new file mode 100644
index 0000000..e55a4f5
--- /dev/null
+++ b/ext/date/tests/bug35425.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #35425 (idate() function ignores timezone settings)
+--INI--
+date.timezone=America/Montreal
+--FILE--
+<?php
+
+$time = mktime(1,1,1,1,1,2005);
+foreach (array('B','d','h','H','i','I','L','m','s','t','U','w','W','y','Y','z','Z') as $v) {
+ var_dump(idate($v, $time));
+}
+
+?>
+--EXPECT--
+int(292)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(1)
+int(31)
+int(1104559261)
+int(6)
+int(53)
+int(5)
+int(2005)
+int(0)
+int(-18000)
diff --git a/ext/date/tests/bug35456.phpt b/ext/date/tests/bug35456.phpt
new file mode 100644
index 0000000..6432b99
--- /dev/null
+++ b/ext/date/tests/bug35456.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #35456 (+ 1 [time unit] format did not work)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$t = 1133216119;
+
+echo date(DATE_ISO8601, strtotime("+ 1 day", $t)) . "\n";
+echo date(DATE_ISO8601, strtotime("+ 1 month", $t)) . "\n";
+echo date(DATE_ISO8601, strtotime("+ 1 week", $t)) . "\n";
+?>
+--EXPECT--
+2005-11-29T22:15:19+0000
+2005-12-28T22:15:19+0000
+2005-12-05T22:15:19+0000
diff --git a/ext/date/tests/bug35499.phpt b/ext/date/tests/bug35499.phpt
new file mode 100644
index 0000000..03f5205
--- /dev/null
+++ b/ext/date/tests/bug35499.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Bug #35499 (strtotime() does not handle whitespace around the date string)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date(DATE_ISO8601, strtotime("11/20/2005 8:00 AM \r\n")) . "\n";
+echo date(DATE_ISO8601, strtotime(" 11/20/2005 8:00 AM \r\n")) . "\n";
+var_dump(date_parse(" a "));
+var_dump(date_parse(" \n "));
+?>
+--EXPECT--
+2005-11-20T08:00:00+0000
+2005-11-20T08:00:00+0000
+array(16) {
+ ["year"]=>
+ bool(false)
+ ["month"]=>
+ bool(false)
+ ["day"]=>
+ bool(false)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(true)
+ ["zone_type"]=>
+ int(2)
+ ["zone"]=>
+ int(-60)
+ ["is_dst"]=>
+ bool(false)
+ ["tz_abbr"]=>
+ string(1) "A"
+}
+array(12) {
+ ["year"]=>
+ bool(false)
+ ["month"]=>
+ bool(false)
+ ["day"]=>
+ bool(false)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
diff --git a/ext/date/tests/bug35624.phpt b/ext/date/tests/bug35624.phpt
new file mode 100644
index 0000000..722adba
--- /dev/null
+++ b/ext/date/tests/bug35624.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #35624 (strtotime() does not handle 3 character weekdays)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$days = array("monday","mon","tuesday","tue","wednesday","wed","thursday","thu","friday","fri","saturday","sat","sunday","sun");
+
+foreach ($days as $day) {
+ echo date("D", strtotime($day));
+ echo date("D", strtotime(ucfirst($day)));
+ echo "\n";
+}
+?>
+--EXPECT--
+MonMon
+MonMon
+TueTue
+TueTue
+WedWed
+WedWed
+ThuThu
+ThuThu
+FriFri
+FriFri
+SatSat
+SatSat
+SunSun
+SunSun
diff --git a/ext/date/tests/bug35630.phpt b/ext/date/tests/bug35630.phpt
new file mode 100644
index 0000000..b111b1a
--- /dev/null
+++ b/ext/date/tests/bug35630.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #35630 (strtotime() crashes on non-separated relative modifiers)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date(DATE_ISO8601, strtotime('5 january 2006+3day+1day')) . "\n";
+
+?>
+--EXPECT--
+2006-01-09T00:00:00+0000
diff --git a/ext/date/tests/bug35699.phpt b/ext/date/tests/bug35699.phpt
new file mode 100644
index 0000000..5e4951e
--- /dev/null
+++ b/ext/date/tests/bug35699.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #35699 (date() can't handle leap years before 1970)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date(DATE_ISO8601, strtotime('1964-06-06')), "\n";
+echo date(DATE_ISO8601, strtotime('1963-06-06')), "\n";
+echo date(DATE_ISO8601, strtotime('1964-01-06')), "\n";
+?>
+--EXPECT--
+1964-06-06T00:00:00+0000
+1963-06-06T00:00:00+0000
+1964-01-06T00:00:00+0000
diff --git a/ext/date/tests/bug35705.phpt b/ext/date/tests/bug35705.phpt
new file mode 100644
index 0000000..6894160
--- /dev/null
+++ b/ext/date/tests/bug35705.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #35705 (strtotime() fails to parse soap date format without TZ)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date(DATE_ISO8601, strtotime('2000-10-10T10:12:30.000')) . "\n";
+
+?>
+--EXPECT--
+2000-10-10T10:12:30+0000
diff --git a/ext/date/tests/bug35885.phpt b/ext/date/tests/bug35885.phpt
new file mode 100644
index 0000000..b3074f7
--- /dev/null
+++ b/ext/date/tests/bug35885.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #35885 (strtotime("NOW") no longer works)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$time = time();
+$ts = date(DATE_ISO8601, strtotime('NOW', $time));
+$ts2 = date(DATE_ISO8601, $time);
+
+$res = ($ts == $ts2);
+var_dump($res);
+
+if (!$res) {
+ var_dump($ts);
+ var_dump($ts2);
+}
+
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/date/tests/bug35887.phpt b/ext/date/tests/bug35887.phpt
new file mode 100644
index 0000000..e6ea7bd
--- /dev/null
+++ b/ext/date/tests/bug35887.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #35887 (wddx_deserialize not parsing dateTime fields properly)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date(DATE_ISO8601, strtotime('2006-1-6T0:0:0-8:0')) . "\n";
+
+?>
+--EXPECT--
+2006-01-06T08:00:00+0000
diff --git a/ext/date/tests/bug36224.phpt b/ext/date/tests/bug36224.phpt
new file mode 100644
index 0000000..1690f4e
--- /dev/null
+++ b/ext/date/tests/bug36224.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #36224 (date(DATE_ATOM) gives wrong resulsts)
+--FILE--
+<?php
+date_default_timezone_set("Europe/Oslo");
+
+echo date(DATE_ATOM, strtotime('2006-01-31T19:23:56Z')) . "\n";
+echo date(DATE_ATOM, strtotime('2006-01-31T19:23:56')) . "\n";
+
+?>
+--EXPECT--
+2006-01-31T20:23:56+01:00
+2006-01-31T19:23:56+01:00
diff --git a/ext/date/tests/bug36510.phpt b/ext/date/tests/bug36510.phpt
new file mode 100644
index 0000000..ea8bb02
--- /dev/null
+++ b/ext/date/tests/bug36510.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #36510 (strtotime() fails to parse date strings with tabs)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$t = 1140973388;
+
+var_dump(strtotime("-2 hours", $t));
+var_dump(strtotime("-2\thours", $t));
+?>
+--EXPECT--
+int(1140966188)
+int(1140966188)
diff --git a/ext/date/tests/bug36599.phpt b/ext/date/tests/bug36599.phpt
new file mode 100644
index 0000000..b34a7c2
--- /dev/null
+++ b/ext/date/tests/bug36599.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #36599 (DATE_W3C format constant incorrect).
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date( DATE_ATOM, strtotime( "2006-03-03 08:47:55" ) ), "\n";
+echo date( DATE_W3C, strtotime( "2006-03-03 08:47:55" ) ), "\n";
+?>
+--EXPECT--
+2006-03-03T08:47:55+00:00
+2006-03-03T08:47:55+00:00
diff --git a/ext/date/tests/bug36988.phpt b/ext/date/tests/bug36988.phpt
new file mode 100644
index 0000000..c37d1fb
--- /dev/null
+++ b/ext/date/tests/bug36988.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #36988 (mktime freezes on long numbers)
+--FILE--
+<?php
+date_default_timezone_set('GMT');
+$start = microtime(true);
+$a = mktime(1, 1, 1, 1, 1, 11111111111);
+echo (microtime(true) - $start) < 1 ? "smaller than one second" : "more than a second";
+?>
+--EXPECT--
+smaller than one second
diff --git a/ext/date/tests/bug37017.phpt b/ext/date/tests/bug37017.phpt
new file mode 100644
index 0000000..6336e71
--- /dev/null
+++ b/ext/date/tests/bug37017.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #37017 (strtotime fails before 13:00:00 with some time zones identifiers).
+--FILE--
+<?php
+date_default_timezone_set('GMT');
+echo strtotime("2006-05-12 13:00:01 America/New_York"), "\n";
+echo strtotime("2006-05-12 13:00:00 America/New_York"), "\n";
+echo strtotime("2006-05-12 12:59:59 America/New_York"), "\n";
+echo strtotime("2006-05-12 12:59:59 GMT"), "\n";
+?>
+--EXPECT--
+1147453201
+1147453200
+1147453199
+1147438799
diff --git a/ext/date/tests/bug37368.phpt b/ext/date/tests/bug37368.phpt
new file mode 100644
index 0000000..7f526a4
--- /dev/null
+++ b/ext/date/tests/bug37368.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #37368 (Incorrect timestamp returned for strtotime()).
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+echo date("r", strtotime("Mon, 08 May 2006 13:06:44 -0400 +30 days"));
+?>
+--EXPECT--
+Wed, 07 Jun 2006 17:06:44 +0000
diff --git a/ext/date/tests/bug37514.phpt b/ext/date/tests/bug37514.phpt
new file mode 100644
index 0000000..fbde5e2
--- /dev/null
+++ b/ext/date/tests/bug37514.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #37514 (strtotime doesn't assume year correctly).
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+echo date('r', strtotime('May 18th 5:05', 1168156376)), "\n";
+echo date('r', strtotime('May 18th 5:05pm', 1168156376)), "\n";
+echo date('r', strtotime('May 18th 5:05 pm', 1168156376)), "\n";
+echo date('r', strtotime('May 18th 5:05am', 1168156376)), "\n";
+echo date('r', strtotime('May 18th 5:05 am', 1168156376)), "\n";
+echo date('r', strtotime('May 18th 2006 5:05pm', 1168156376)), "\n";
+?>
+--EXPECT--
+Fri, 18 May 2007 05:05:00 +0000
+Fri, 18 May 2007 17:05:00 +0000
+Fri, 18 May 2007 17:05:00 +0000
+Fri, 18 May 2007 05:05:00 +0000
+Fri, 18 May 2007 05:05:00 +0000
+Thu, 18 May 2006 17:05:00 +0000
diff --git a/ext/date/tests/bug37616.phpt b/ext/date/tests/bug37616.phpt
new file mode 100644
index 0000000..7652501
--- /dev/null
+++ b/ext/date/tests/bug37616.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #37616 (DATE_RFC822 does not product RFC 822 dates)
+--FILE--
+<?php
+ date_default_timezone_set("Europe/Oslo");
+ var_dump(date(DATE_RFC822, strtotime("1 Jul 06 14:27:30 +0200")));
+?>
+--EXPECT--
+string(29) "Sat, 01 Jul 06 14:27:30 +0200"
diff --git a/ext/date/tests/bug37747.phpt b/ext/date/tests/bug37747.phpt
new file mode 100644
index 0000000..465f791
--- /dev/null
+++ b/ext/date/tests/bug37747.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #37747 (strtotime segfaults when given "nextyear")
+--FILE--
+<?php
+ date_default_timezone_set("Europe/Oslo");
+ var_dump(strtotime("nextyear"));
+ echo "ALIVE\n";
+?>
+--EXPECT--
+bool(false)
+ALIVE
diff --git a/ext/date/tests/bug38229.phpt b/ext/date/tests/bug38229.phpt
new file mode 100644
index 0000000..472a05f
--- /dev/null
+++ b/ext/date/tests/bug38229.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #38229 (strtotime() does not parse YYYY-MM)
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+echo date("Y-m", strtotime('2006-1'))."\n";
+echo date("Y-m", strtotime('2006-03'))."\n";
+echo date("Y-m", strtotime('2006-12'))."\n";
+?>
+--EXPECT--
+2006-01
+2006-03
+2006-12
diff --git a/ext/date/tests/bug39782.phpt b/ext/date/tests/bug39782.phpt
new file mode 100644
index 0000000..99abdd7
--- /dev/null
+++ b/ext/date/tests/bug39782.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #39782 (setTime() on a DateTime constructed with a Weekday yields incorrect results)
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+
+$dttTest = new DateTime('Dec 10 2006 Next Wednesday');
+echo $dttTest->format('D M j Y - H:i:s') . "\n";
+
+$dttTest->setTime(12, 0, 0);
+echo $dttTest->format('D M j Y - H:i:s') . "\n";
+
+$dttTest->setTime(12, 0, 0);
+echo $dttTest->format('D M j Y - H:i:s') . "\n";
+?>
+--EXPECT--
+Wed Dec 13 2006 - 00:00:00
+Wed Dec 13 2006 - 12:00:00
+Wed Dec 13 2006 - 12:00:00 \ No newline at end of file
diff --git a/ext/date/tests/bug40743.phpt b/ext/date/tests/bug40743.phpt
new file mode 100644
index 0000000..f3ce171
--- /dev/null
+++ b/ext/date/tests/bug40743.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #40743 (DateTime ignores the TimeZone object passed to the constructor)
+--FILE--
+<?php
+$dt = new DateTime('@1200506699', new DateTimeZone('Europe/Berlin'));
+echo $dt->format(DATE_RFC822), "\n";
+echo $dt->format('T e Z'), "\n";
+echo "-----\n";
+
+date_default_timezone_set('America/New_York');
+
+$dt = new DateTime('16 Jan 08 13:04:59');
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('@1200506699');
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('@1200506699');
+$dt->setTimezone( new DateTimeZone( 'America/New_York' ) );
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('@1200506699', new DateTimeZone('Europe/Berlin'));
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('16 Jan 08 13:04:59 America/Chicago');
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('16 Jan 08 13:04:59 America/Chicago', new DateTimeZone('Europe/Berlin'));
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+?>
+--EXPECT--
+Wed, 16 Jan 08 18:04:59 +0000
+GMT+0000 +00:00 0
+-----
+Wed, 16 Jan 08 13:04:59 -0500 America/New_York EST -0500 1200506699
+Wed, 16 Jan 08 18:04:59 +0000 +00:00 GMT+0000 +0000 1200506699
+Wed, 16 Jan 08 13:04:59 -0500 America/New_York EST -0500 1200506699
+Wed, 16 Jan 08 18:04:59 +0000 +00:00 GMT+0000 +0000 1200506699
+Wed, 16 Jan 08 13:04:59 -0600 America/Chicago CST -0600 1200510299
+Wed, 16 Jan 08 13:04:59 -0600 America/Chicago CST -0600 1200510299
diff --git a/ext/date/tests/bug40861.phpt b/ext/date/tests/bug40861.phpt
new file mode 100644
index 0000000..d4ef961
--- /dev/null
+++ b/ext/date/tests/bug40861.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #40861 (Multiple +/- on relative units breaks strtotime())
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+
+$offset = +60;
+$ts = strtotime('2000-01-01 12:00:00');
+$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
+echo $result . "\n";
+
+$offset = -60;
+$ts = strtotime('2000-01-01 12:00:00');
+$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
+echo $result . "\n";
+
+$offset = -60;
+$ts = strtotime('2000-01-01 12:00:00');
+$result = date("Y-m-d H:i:s", strtotime("-$offset minutes", $ts));
+echo $result . "\n";
+
+
+$offset = 60;
+$ts = strtotime('2000-01-01 12:00:00');
+$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
+echo $result . "\n";
+
+?>
+--EXPECT--
+2000-01-01 13:00:00
+2000-01-01 11:00:00
+2000-01-01 13:00:00
+2000-01-01 13:00:00
diff --git a/ext/date/tests/bug41523-64bit.phpt b/ext/date/tests/bug41523-64bit.phpt
new file mode 100644
index 0000000..d6d1320
--- /dev/null
+++ b/ext/date/tests/bug41523-64bit.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+var_dump( date_parse('0000-00-00 00:00:00') );
+var_dump( strtotime('0000-00-00 00:00:00') );
+var_dump( $dt = new DateTime('0000-00-00 00:00:00') );
+echo $dt->format( DateTime::ISO8601 ), "\n";
+
+?>
+--EXPECT--
+array(12) {
+ ["year"]=>
+ int(0)
+ ["month"]=>
+ int(0)
+ ["day"]=>
+ int(0)
+ ["hour"]=>
+ int(0)
+ ["minute"]=>
+ int(0)
+ ["second"]=>
+ int(0)
+ ["fraction"]=>
+ float(0)
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [20]=>
+ string(27) "The parsed date was invalid"
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+int(-62169984000)
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(20) "-0001-11-30 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+-0001-11-30T00:00:00+0000
diff --git a/ext/date/tests/bug41523.phpt b/ext/date/tests/bug41523.phpt
new file mode 100644
index 0000000..948dae7
--- /dev/null
+++ b/ext/date/tests/bug41523.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+var_dump( date_parse('0000-00-00 00:00:00') );
+var_dump( strtotime('0000-00-00 00:00:00') );
+var_dump( $dt = new DateTime('0000-00-00 00:00:00') );
+echo $dt->format( DateTime::ISO8601 ), "\n";
+
+?>
+--EXPECT--
+array(12) {
+ ["year"]=>
+ int(0)
+ ["month"]=>
+ int(0)
+ ["day"]=>
+ int(0)
+ ["hour"]=>
+ int(0)
+ ["minute"]=>
+ int(0)
+ ["second"]=>
+ int(0)
+ ["fraction"]=>
+ float(0)
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [20]=>
+ string(27) "The parsed date was invalid"
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+bool(false)
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(20) "-0001-11-30 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+-0001-11-30T00:00:00+0000
diff --git a/ext/date/tests/bug41599.phpt b/ext/date/tests/bug41599.phpt
new file mode 100644
index 0000000..e4febe2
--- /dev/null
+++ b/ext/date/tests/bug41599.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #41599 (setTime() fails after modify() is used)
+--FILE--
+<?php
+date_default_timezone_set('Europe/London');
+
+$start = new DateTime('2008-01-17 last Monday');
+echo $start->format('Y-m-d H:i:s'),PHP_EOL;
+//good
+
+$start->modify('Tuesday');
+echo $start->format('Y-m-d H:i:s'),PHP_EOL;
+//good
+
+$start->setTime(4, 0, 0);
+echo $start->format('Y-m-d H:i:s'),PHP_EOL;
+//jumped to next Sunday
+
+$start->setTime(8, 0, 0);
+echo $start->format('Y-m-d H:i:s'),PHP_EOL;
+//jumped to next Sunday again
+?>
+--EXPECT--
+2008-01-14 00:00:00
+2008-01-15 00:00:00
+2008-01-15 04:00:00
+2008-01-15 08:00:00
diff --git a/ext/date/tests/bug41709.phpt b/ext/date/tests/bug41709.phpt
new file mode 100644
index 0000000..624da0c
--- /dev/null
+++ b/ext/date/tests/bug41709.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #41709 (strtotime() does not handle 00.00.0000)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$date_string = '00.00.0000 - 00:00:00';
+print_r(date_parse($date_string));
+
+?>
+--EXPECT--
+Array
+(
+ [year] => 0
+ [month] => 0
+ [day] => 0
+ [hour] => 0
+ [minute] => 0
+ [second] => 0
+ [fraction] => 0
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [22] => The parsed date was invalid
+ )
+
+ [error_count] => 1
+ [errors] => Array
+ (
+ [11] => Unexpected character
+ )
+
+ [is_localtime] =>
+)
diff --git a/ext/date/tests/bug41842.phpt b/ext/date/tests/bug41842.phpt
new file mode 100644
index 0000000..b2a5ef3
--- /dev/null
+++ b/ext/date/tests/bug41842.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #41842 (Cannot create years < 0100 & negative years with date_create or new DateTime)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$date = new DateTime('-2007-06-28 00:00:00');
+echo $date->format(DATE_ISO8601);
+?>
+--EXPECT--
+-2007-06-28T00:00:00+0000
diff --git a/ext/date/tests/bug41844.phpt b/ext/date/tests/bug41844.phpt
new file mode 100644
index 0000000..c18b2f7
--- /dev/null
+++ b/ext/date/tests/bug41844.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #41844 (Format returns incorrect number of digits for negative years -0001 to -0999)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+$date = new DateTime('2007-06-28');
+$date->modify('-3006 years');
+echo $date->format(DATE_ISO8601), "\n";
+
+$date = new DateTime('2007-06-28');
+$date->modify('-2008 years');
+echo $date->format(DATE_ISO8601), "\n";
+?>
+--EXPECT--
+-0999-06-28T00:00:00+0000
+-0001-06-28T00:00:00+0000
diff --git a/ext/date/tests/bug41964.phpt b/ext/date/tests/bug41964.phpt
new file mode 100644
index 0000000..022a186
--- /dev/null
+++ b/ext/date/tests/bug41964.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Bug #41964 (strtotime returns a timestamp for non-time string of pattern '(A|a) .+')
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+error_reporting(0);
+
+$res = date_parse('Ask the Experts');
+var_dump($res['zone'], $res['tz_abbr']);
+echo "\n";
+
+$res = date_parse('A ');
+var_dump($res['zone'], $res['tz_abbr']);
+echo "\n";
+
+$res = date_parse('A');
+var_dump($res['zone'], $res['tz_abbr']);
+echo "\n";
+
+$res = date_parse('a ');
+var_dump($res['zone'], $res['tz_abbr']);
+echo "\n";
+
+$res = date_parse('a');
+var_dump($res['zone'], $res['tz_abbr']);
+echo "\n";
+
+$res = date_parse('A Revolution in Development');
+var_dump($res['zone'], $res['tz_abbr']);
+echo "\n";
+
+$res = date_parse('a nothing');
+var_dump($res['zone'], $res['tz_abbr']);
+echo "\n";
+
+
+?>
+--EXPECT--
+NULL
+NULL
+
+int(-60)
+string(1) "A"
+
+int(-60)
+string(1) "A"
+
+int(-60)
+string(1) "A"
+
+int(-60)
+string(1) "A"
+
+int(-60)
+string(1) "A"
+
+int(-60)
+string(1) "A"
diff --git a/ext/date/tests/bug42910.phpt b/ext/date/tests/bug42910.phpt
new file mode 100644
index 0000000..1bd0790
--- /dev/null
+++ b/ext/date/tests/bug42910.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #42910 (Constructing DateTime with TimeZone Indicator invalidates DateTimeZone)
+--FILE--
+<?php
+ date_default_timezone_set('America/Los_Angeles');
+ $foo = new DateTime('2007-03-11');
+ $bar = new DateTime('2007-03-11T00:00:00-0800');
+
+ print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n";
+ print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n";
+
+ $foo->setDate(2007, 03, 12);
+ $bar->setDate(2007, 03, 12);
+
+ print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n";
+ print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n";
+
+// --------------
+
+ date_default_timezone_set('Australia/Sydney');
+
+ $date= date_create('2007-11-04 12:00:00+0200');
+ var_dump(date_format($date, 'O e'));
+?>
+--EXPECT--
+2007-03-11T00:00:00-0800 - America/Los_Angeles - 1173600000
+2007-03-11T00:00:00-0800 - -08:00 - 1173600000
+2007-03-12T00:00:00-0700 - America/Los_Angeles - 1173682800
+2007-03-12T00:00:00-0800 - -08:00 - 1173686400
+string(12) "+0200 +02:00"
diff --git a/ext/date/tests/bug43003.phpt b/ext/date/tests/bug43003.phpt
new file mode 100644
index 0000000..8070358
--- /dev/null
+++ b/ext/date/tests/bug43003.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #43003 (Invalid timezone reported for DateTime objects constructed using a timestamp)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+
+$oDateTest = new DateTime("@0", new DateTimeZone(date_default_timezone_get()));
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+
+$oDateTest->setTimezone(new DateTimeZone("UTC"));
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+
+$oDateTest->setTimezone(new DateTimeZone(date_default_timezone_get()));
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+
+$oDateTest = new DateTime("@0");
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+
+$oDateTest->setTimezone( new DateTimeZone(date_default_timezone_get()));
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+?>
+--EXPECT--
++00:00: 1970-01-01 00:00:00
+UTC: 1970-01-01 00:00:00
+Europe/Oslo: 1970-01-01 01:00:00
++00:00: 1970-01-01 00:00:00
+Europe/Oslo: 1970-01-01 01:00:00
diff --git a/ext/date/tests/bug43075.phpt b/ext/date/tests/bug43075.phpt
new file mode 100644
index 0000000..e33a3bc
--- /dev/null
+++ b/ext/date/tests/bug43075.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #43075 (Support 24 as hour)
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+$d = date_create("2007-11-01T24:34:00+00:00");
+echo $d->format("c");
+?>
+--EXPECT--
+2007-11-02T00:34:00+00:00
diff --git a/ext/date/tests/bug43452.phpt b/ext/date/tests/bug43452.phpt
new file mode 100644
index 0000000..8780474
--- /dev/null
+++ b/ext/date/tests/bug43452.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Bug #43452 ("weekday" is not equivalent to "1 weekday" of the current weekday is "weekday")
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+// <day> is equivalent to 1 <day> and will *not* forward if the current day
+// (November 1st) is the same day of week.
+$day = strtotime( "Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "1 Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "2 Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "3 Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n\n";
+
+// forward one week, then behaves like above for week days
+$day = strtotime( "Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "+1 week Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "+2 week Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "+3 week Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n\n";
+
+// First, second, etc skip to the first/second weekday *after* the current day.
+// This makes "first thursday" equivalent to "+1 week thursday" - but only
+// if the current day-of-week is the one mentioned in the phrase.
+$day = strtotime( "Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "first Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "second Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "third Thursday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n\n";
+
+// Now the same where the current day-of-week does not match the one in the
+// phrase.
+$day = strtotime( "Friday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "first Friday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "second Friday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n";
+$day = strtotime( "third Friday Nov 2007" );
+echo date( DateTime::ISO8601, $day ), "\n\n";
+
+?>
+--EXPECT--
+2007-11-01T00:00:00+0100
+2007-11-01T00:00:00+0100
+2007-11-08T00:00:00+0100
+2007-11-15T00:00:00+0100
+
+2007-11-01T00:00:00+0100
+2007-11-08T00:00:00+0100
+2007-11-15T00:00:00+0100
+2007-11-22T00:00:00+0100
+
+2007-11-01T00:00:00+0100
+2007-11-08T00:00:00+0100
+2007-11-15T00:00:00+0100
+2007-11-22T00:00:00+0100
+
+2007-11-02T00:00:00+0100
+2007-11-02T00:00:00+0100
+2007-11-09T00:00:00+0100
+2007-11-16T00:00:00+0100
diff --git a/ext/date/tests/bug43527.phpt b/ext/date/tests/bug43527.phpt
new file mode 100644
index 0000000..cc69def
--- /dev/null
+++ b/ext/date/tests/bug43527.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #43527 (DateTime created from a timestamp reports environment timezone)
+--FILE--
+<?php
+date_default_timezone_set("Etc/GMT+1");
+$datetime = new DateTime('Fri, 07 Dec 2007 19:05:14 +1000');
+echo $datetime->getTimezone()->getName(), "\n";
+?>
+--EXPECT--
++10:00
diff --git a/ext/date/tests/bug43808.phpt b/ext/date/tests/bug43808.phpt
new file mode 100644
index 0000000..74b2317
--- /dev/null
+++ b/ext/date/tests/bug43808.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Bug #43808 (date_create never fails (even when it should))
+--FILE--
+<?php
+$date = date_create('asdfasdf');
+
+if ($date instanceof DateTime) {
+ echo "this is wrong, should be bool";
+}
+
+var_dump( $date );
+var_dump( DateTime::getLastErrors() );
+var_dump( date_get_last_errors() );
+?>
+--EXPECT--
+bool(false)
+array(4) {
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [6]=>
+ string(29) "Double timezone specification"
+ }
+ ["error_count"]=>
+ int(1)
+ ["errors"]=>
+ array(1) {
+ [0]=>
+ string(47) "The timezone could not be found in the database"
+ }
+}
+array(4) {
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [6]=>
+ string(29) "Double timezone specification"
+ }
+ ["error_count"]=>
+ int(1)
+ ["errors"]=>
+ array(1) {
+ [0]=>
+ string(47) "The timezone could not be found in the database"
+ }
+}
diff --git a/ext/date/tests/bug43960.phpt b/ext/date/tests/bug43960.phpt
new file mode 100644
index 0000000..c33dff2
--- /dev/null
+++ b/ext/date/tests/bug43960.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #43960 (strtotime() returns timestamp in the future when given a bogus string)
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+var_dump(strtotime('i like to eat slices at work'));
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/date/tests/bug44562.phpt b/ext/date/tests/bug44562.phpt
new file mode 100644
index 0000000..89ca740
--- /dev/null
+++ b/ext/date/tests/bug44562.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Bug #44562 (Creating instance of DatePeriod crashes)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+
+try
+{
+ $dp = new DatePeriod('2D');
+}
+catch ( Exception $e )
+{
+ echo $e->getMessage(), "\n";
+}
+
+$begin = new DateTime( "2008-07-20T22:44:53+0200" );
+$interval = DateInterval::createFromDateString( "1 day" );
+
+$dp = new DatePeriod( $begin, $interval, 10 );
+foreach ( $dp as $d )
+{
+ var_dump ($d->format( DATE_ISO8601 ) );
+}
+
+?>
+--EXPECT--
+DatePeriod::__construct(): Unknown or bad format (2D)
+string(24) "2008-07-20T22:44:53+0200"
+string(24) "2008-07-21T22:44:53+0200"
+string(24) "2008-07-22T22:44:53+0200"
+string(24) "2008-07-23T22:44:53+0200"
+string(24) "2008-07-24T22:44:53+0200"
+string(24) "2008-07-25T22:44:53+0200"
+string(24) "2008-07-26T22:44:53+0200"
+string(24) "2008-07-27T22:44:53+0200"
+string(24) "2008-07-28T22:44:53+0200"
+string(24) "2008-07-29T22:44:53+0200"
+string(24) "2008-07-30T22:44:53+0200"
diff --git a/ext/date/tests/bug44742.phpt b/ext/date/tests/bug44742.phpt
new file mode 100644
index 0000000..48952b4
--- /dev/null
+++ b/ext/date/tests/bug44742.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #44742 (timezone_offset_get() causes segmentation faults)
+--FILE--
+<?php
+date_default_timezone_set('Europe/London');
+$dates = array(
+ "2008-04-11 00:00:00+0000",
+ "2008-04-11 00:00:00+0200",
+ "2008-04-11 00:00:00+0330",
+ "2008-04-11 00:00:00-0500",
+ "2008-04-11 00:00:00-1130",
+ "2008-04-11 00:00:00 CEST",
+ "2008-04-11 00:00:00 CET",
+ "2008-04-11 00:00:00 UTC",
+ "2008-04-11 00:00:00 America/New_York",
+ "2008-04-11 00:00:00 Europe/Oslo",
+ "2008-04-11 00:00:00 Asia/Singapore",
+);
+foreach ($dates as $date)
+{
+ $date = date_create($date);
+ var_dump(timezone_offset_get(date_timezone_get($date), $date));
+}
+?>
+--EXPECT--
+int(0)
+int(7200)
+int(12600)
+int(-18000)
+int(-41400)
+int(7200)
+int(3600)
+int(0)
+int(-14400)
+int(7200)
+int(28800)
diff --git a/ext/date/tests/bug45529.phpt b/ext/date/tests/bug45529.phpt
new file mode 100644
index 0000000..b5d1d6a
--- /dev/null
+++ b/ext/date/tests/bug45529.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #45529 (UTC not properly recognised as timezone identifier while parsing)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+$tz1 = new DateTimeZone('UTC');
+$tz2 = date_create('UTC')->getTimeZone();
+echo $tz1->getName(), PHP_EOL;
+echo $tz2->getName(), PHP_EOL;
+$d = new DateTime('2008-01-01 12:00:00+0200');
+$d->setTimeZone($tz1);
+echo $d->format(DATE_ISO8601), PHP_EOL;
+$d = new DateTime('2008-01-01 12:00:00+0200');
+$d->setTimeZone($tz2);
+echo $d->format(DATE_ISO8601), PHP_EOL;
+?>
+--EXPECT--
+UTC
+UTC
+2008-01-01T10:00:00+0000
+2008-01-01T10:00:00+0000
diff --git a/ext/date/tests/bug45554.phpt b/ext/date/tests/bug45554.phpt
new file mode 100644
index 0000000..a5042ff
--- /dev/null
+++ b/ext/date/tests/bug45554.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #45554 (Inconsistent behavior of the u format char)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$format = "m-d-Y H:i:s.u T";
+$d = date_create_from_format($format, "03-15-2005 12:22:29.000000 PST");
+echo $d->format($format), "\n";
+
+$d = date_create_from_format($format, "03-15-2005 12:22:29.001001 PST");
+echo $d->format($format), "\n";
+
+$d = date_create_from_format($format, "03-15-2005 12:22:29.0010 PST");
+echo $d->format($format), "\n";
+?>
+--EXPECT--
+03-15-2005 12:22:29.000000 PST
+03-15-2005 12:22:29.001001 PST
+03-15-2005 12:22:29.001000 PST
diff --git a/ext/date/tests/bug45682.phpt b/ext/date/tests/bug45682.phpt
new file mode 100644
index 0000000..d8bbfc5
--- /dev/null
+++ b/ext/date/tests/bug45682.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #45682 (Unable to var_dump(DateInterval))
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+
+$date = new DateTime("28-July-2008");
+$other = new DateTime("31-July-2008");
+
+$diff = date_diff($date, $other);
+
+var_dump($diff);
+--EXPECT--
+object(DateInterval)#3 (8) {
+ ["y"]=>
+ int(0)
+ ["m"]=>
+ int(0)
+ ["d"]=>
+ int(3)
+ ["h"]=>
+ int(0)
+ ["i"]=>
+ int(0)
+ ["s"]=>
+ int(0)
+ ["invert"]=>
+ int(0)
+ ["days"]=>
+ int(3)
+}
diff --git a/ext/date/tests/bug45866.phpt b/ext/date/tests/bug45866.phpt
new file mode 100644
index 0000000..a8407a6
--- /dev/null
+++ b/ext/date/tests/bug45866.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #45866 (decimal values fed to DateTime->modify() causes long execution times)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$date = new DateTime( '2009-07-29 16:44:23 Europe/London' );
+$date->modify( "+1.61538461538 day" );
+echo $date->format( 'r' ), "\n";
+
+$date = new DateTime( '2009-07-29 16:44:23 Europe/London' );
+$date->modify( "61538461538 day" );
+echo $date->format( 'r' ), "\n";
+
+$date = new DateTime( '2009-07-29 16:44:23 Europe/London' );
+$date->modify( "£61538461538 day" );
+echo $date->format( 'r' ), "\n";
+?>
+--EXPECTF--
+Thu, 14 Aug 168488594 16:44:23 +0000
+Thu, 14 Aug 168488594 16:44:23 +0000
+
+Warning: DateTime::modify(): Failed to parse time string (£61538461538 day) at position 0 (%s): Unexpected character in %sbug45866.php on line 11
+Wed, 29 Jul 2009 16:44:23 +0100
diff --git a/ext/date/tests/bug46108.phpt b/ext/date/tests/bug46108.phpt
new file mode 100644
index 0000000..12fdfa7
--- /dev/null
+++ b/ext/date/tests/bug46108.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #46108 (DateTime - Memory leak when unserializing)
+--FILE--
+<?php
+
+date_default_timezone_set('America/Sao_Paulo');
+
+var_dump(unserialize(serialize(new Datetime)));
+
+?>
+--EXPECTF--
+object(DateTime)#%d (3) {
+ [%u|b%"date"]=>
+ %string|unicode%(%d) "%s"
+ [%u|b%"timezone_type"]=>
+ int(%d)
+ [%u|b%"timezone"]=>
+ %string|unicode%(%d) "America/Sao_Paulo"
+}
diff --git a/ext/date/tests/bug46111.phpt b/ext/date/tests/bug46111.phpt
new file mode 100644
index 0000000..806424e
--- /dev/null
+++ b/ext/date/tests/bug46111.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #46111 (strtotime() returns false for some valid timezones)
+--FILE--
+<?php
+date_default_timezone_set('Asia/Calcutta');
+$timezones = timezone_identifiers_list();
+
+# An empty list indicates no errors
+print "[strtotime(timezone) == false - Begin List]\n";
+foreach ($timezones as $zone) {
+ $date_string = "2008-01-01 13:00:00 " . $zone;
+
+ if (!strtotime($date_string)) {
+ echo $zone . "\n";
+ }
+}
+print "[strtotime(timezone) == false - End List]\n";
+?>
+--EXPECT--
+[strtotime(timezone) == false - Begin List]
+[strtotime(timezone) == false - End List]
diff --git a/ext/date/tests/bug46268.phpt b/ext/date/tests/bug46268.phpt
new file mode 100644
index 0000000..808fd85
--- /dev/null
+++ b/ext/date/tests/bug46268.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #46268 (When call DateTime#setTime, it seems to be called the last modify method too)
+--FILE--
+<?php
+date_default_timezone_set('Asia/Tokyo');
+
+$now = new DateTime('2008-10-10 01:02:03');
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->modify("1 day");
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->modify("1 hour");
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->setTime(0, 0, 0);
+//date_time_set($now, 0, 0, 0);
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+--EXPECT--
+2008-10-10 01:02:03
+2008-10-11 01:02:03
+2008-10-11 02:02:03
+2008-10-11 00:00:00
diff --git a/ext/date/tests/bug46874.phpt b/ext/date/tests/bug46874.phpt
new file mode 100644
index 0000000..ee3546e
--- /dev/null
+++ b/ext/date/tests/bug46874.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #46874 (DatePeriod not resetting after foreach loop)
+--FILE--
+<?php
+$dp = new DatePeriod('R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M');
+
+foreach ($dp as $date) {
+ echo $date->format("Y-m-d H:i:s\n");
+}
+
+echo "\n";
+
+// this should repeat the same range
+foreach ($dp as $date) {
+ echo $date->format("Y-m-d H:i:s\n");
+}
+?>
+--EXPECT--
+2008-03-01 13:00:00
+2009-05-11 15:30:00
+2010-07-21 18:00:00
+2011-10-01 20:30:00
+2012-12-11 23:00:00
+2014-02-22 01:30:00
+
+2008-03-01 13:00:00
+2009-05-11 15:30:00
+2010-07-21 18:00:00
+2011-10-01 20:30:00
+2012-12-11 23:00:00
+2014-02-22 01:30:00
diff --git a/ext/date/tests/bug48058.phpt b/ext/date/tests/bug48058.phpt
new file mode 100644
index 0000000..46a1918
--- /dev/null
+++ b/ext/date/tests/bug48058.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #48058 (Year formatter goes wrong with out-of-int range)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+date_default_timezone_set("Europe/London");
+$tz = new DateTimeZone("Europe/London");
+$tran = $tz->getTransitions();
+var_dump( $tran[0] );
+
+$base_time = '28 Feb 2008 12:00:00';
+$dt = date_create( "$base_time +10000000000 years" );
+echo date_format( $dt, DATE_ISO8601 );
+?>
+--EXPECTF--
+array(5) {
+ ["ts"]=>
+ int(-%d)
+ ["time"]=>
+ string(%d) "%s"
+ ["offset"]=>
+ int(3600)
+ ["isdst"]=>
+ bool(true)
+ ["abbr"]=>
+ string(3) "BST"
+}
+10000002008-02-28T12:00:00+0000
diff --git a/ext/date/tests/bug48097.phpt b/ext/date/tests/bug48097.phpt
new file mode 100644
index 0000000..d71a97e
--- /dev/null
+++ b/ext/date/tests/bug48097.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Bug #48097 (date_timezone_set function produces wrong datetime result)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$d = date_create( "Mon, 23 May 1955 00:00:00 +0200" );
+var_dump( $d );
+echo $d->format( DATE_ISO8601 ), "\n";
+echo $d->format( 'U' ), "\n\n";
+
+$d->setTimeZone( new DateTimeZone( 'Europe/Budapest' ) );
+var_dump( $d );
+echo $d->format( DATE_ISO8601 ), "\n\n";
+echo $d->format( 'U' ), "\n\n";
+--EXPECT--
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "1955-05-23 00:00:00"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+1955-05-23T00:00:00+0200
+-461124000
+
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "1955-05-22 23:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(15) "Europe/Budapest"
+}
+1955-05-22T23:00:00+0100
+
+-461124000
diff --git a/ext/date/tests/bug48187.phpt b/ext/date/tests/bug48187.phpt
new file mode 100644
index 0000000..78c0fb2
--- /dev/null
+++ b/ext/date/tests/bug48187.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #48187 (DateTime::diff() corrupting microtime() result)
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+// two arbitrary dates
+$date1 = new DateTime('2005-07-23');
+$date2 = new DateTime('2006-02-14');
+
+$begin_u = microtime(true);
+$begin_t = time();
+
+if (microtime(true) - $begin_u < 1) {
+ var_dump('microtime() difference less 1 second');
+} else {
+ var_dump('microtime() difference greater or equal 1 second');
+}
+
+if (time() - $begin_t < 1) {
+ var_dump('time() difference less 1 second');
+} else {
+ var_dump('time() difference greater or equal 1 second');
+}
+?>
+--EXPECTF--
+string(36) "microtime() difference less 1 second"
+string(31) "time() difference less 1 second" \ No newline at end of file
diff --git a/ext/date/tests/bug48276.phpt b/ext/date/tests/bug48276.phpt
new file mode 100644
index 0000000..d26605d
--- /dev/null
+++ b/ext/date/tests/bug48276.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #48276 (date("Y") prints wrong year on Big Endian machines)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+var_dump(date("Y", 1245623227));
+--EXPECT--
+string(4) "2009"
diff --git a/ext/date/tests/bug48476.phpt b/ext/date/tests/bug48476.phpt
new file mode 100644
index 0000000..2daa594
--- /dev/null
+++ b/ext/date/tests/bug48476.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #48476 (cloning extended DateTime class without calling parent::__constr crashed PHP)
+--FILE--
+<?php
+class MyDateTime extends DateTime {
+ public function __construct() { }
+}
+class MyDateTimeZone extends DateTimeZone {
+ public function __construct() { }
+}
+
+$o = new MyDateTime;
+var_dump($o->format("d"));
+$x = clone $o;
+
+var_dump($x->format("d"));
+
+clone $o;
+
+
+var_dump(timezone_location_get(clone new MyDateTimezone));
+?>
+--EXPECTF--
+Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 10
+bool(false)
+
+Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 13
+bool(false)
+
+Warning: timezone_location_get(): The DateTimeZone object has not been correctly initialized by its constructor in %sbug48476.php on line 18
+bool(false)
+
+
diff --git a/ext/date/tests/bug48678.phpt b/ext/date/tests/bug48678.phpt
new file mode 100644
index 0000000..e2cb724
--- /dev/null
+++ b/ext/date/tests/bug48678.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #48678 (DateInterval segfaults when unserialising)
+--FILE--
+<?php
+$x = new DateInterval("P3Y6M4DT12H30M5S");
+print_r($x);
+$y = unserialize(serialize($x));
+print_r($y);
+--EXPECTF--
+DateInterval Object
+(
+ [y] => 3
+ [m] => 6
+ [d] => 4
+ [h] => 12
+ [i] => 30
+ [s] => 5
+ [invert] => 0
+ [days] =>%s
+)
+DateInterval Object
+(
+ [y] => 3
+ [m] => 6
+ [d] => 4
+ [h] => 12
+ [i] => 30
+ [s] => 5
+ [invert] => 0
+ [days] =>%s
+)
diff --git a/ext/date/tests/bug49059.phpt b/ext/date/tests/bug49059.phpt
new file mode 100644
index 0000000..48d2dac
--- /dev/null
+++ b/ext/date/tests/bug49059.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #49059 (DateTime::diff() repeats previous sub() operation)
+--FILE--
+<?php
+date_default_timezone_set('Asia/Calcutta');
+
+$date1 = date_create("2009-03-27");
+$date2 = date_create("2009-03-01");
+print "\$date1 at init: " . $date1->format("Y-m-d") . "\n";
+print "\$date2 at init: " . $date2->format("Y-m-d") . "\n";
+$diff = $date1->diff($date2);
+print "\$date1 after first diff: " . $date1->format("Y-m-d") . "\n";
+print "\$diff->days after first diff: " . $diff->days . "\n";
+$date1 = $date1->sub(new DateInterval("P2D"));
+print "\$date1 after sub: " . $date1->format("Y-m-d") . "\n";
+$diff = $date1->diff($date2);
+print "\$date1 after second diff (called at \$date1): " .
+$date1->format("Y-m-d") . "\n";
+print "\$diff->days after second diff: " . $diff->days . "\n";
+$diff = $date2->diff($date1);
+print "\$date1 after third diff (called at \$date2): " .
+$date1->format("Y-m-d") . "\n";
+print "\$diff->days after third diff: " . $diff->days . "\n";
+?>
+--EXPECT--
+$date1 at init: 2009-03-27
+$date2 at init: 2009-03-01
+$date1 after first diff: 2009-03-27
+$diff->days after first diff: 26
+$date1 after sub: 2009-03-25
+$date1 after second diff (called at $date1): 2009-03-25
+$diff->days after second diff: 24
+$date1 after third diff (called at $date2): 2009-03-25
+$diff->days after third diff: 24
diff --git a/ext/date/tests/bug49081.phpt b/ext/date/tests/bug49081.phpt
new file mode 100644
index 0000000..f4f0290
--- /dev/null
+++ b/ext/date/tests/bug49081.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #49081 (DateTime::diff() mistake if start in January and interval > 28 days)
+--FILE--
+<?php
+ date_default_timezone_set('Europe/Berlin');
+ $d1 = new DateTime('2010-01-01 06:00:00');
+ $d2 = new DateTime('2010-01-31 10:00:00');
+ $d = $d1->diff($d2);
+ print_r($d);
+?>
+--EXPECT--
+DateInterval Object
+(
+ [y] => 0
+ [m] => 0
+ [d] => 30
+ [h] => 4
+ [i] => 0
+ [s] => 0
+ [invert] => 0
+ [days] => 30
+)
diff --git a/ext/date/tests/bug49585.phpt b/ext/date/tests/bug49585.phpt
new file mode 100644
index 0000000..2ec1424
--- /dev/null
+++ b/ext/date/tests/bug49585.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #49585 (date_format buffer not long enough for >4 digit years)
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$date = new DateTime('-1500-01-01');
+var_dump($date->format('r'));
+
+$date->setDate(-2147483648, 1, 1);
+var_dump($date->format('r'));
+var_dump($date->format('c'));
+--EXPECT--
+string(32) "Sat, 01 Jan -1500 00:00:00 +0000"
+string(42) "Unknown, 01 Jan -2147483648 00:00:00 +0000"
+string(32) "-2147483648-01-01T00:00:00+00:00"
diff --git a/ext/date/tests/bug49700.phpt b/ext/date/tests/bug49700.phpt
new file mode 100644
index 0000000..a347052
--- /dev/null
+++ b/ext/date/tests/bug49700.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #49700 (memory leaks in php_date.c if garbage collector is enabled)
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+gc_enable();
+$objs = array();
+$objs[1] = new DateTime();
+gc_collect_cycles();
+unset($objs);
+echo "OK\n";
+?>
+--EXPECT--
+OK
diff --git a/ext/date/tests/bug49778.phpt b/ext/date/tests/bug49778.phpt
new file mode 100644
index 0000000..67c8e27
--- /dev/null
+++ b/ext/date/tests/bug49778.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #49778 (DateInterval::format("%a") is always zero when an interval is created from an ISO string)
+--FILE--
+<?php
+$i=new DateInterval('P7D');
+var_dump($i);
+echo $i->format("%d"), "\n";
+echo $i->format("%a"), "\n";
+?>
+--EXPECT--
+object(DateInterval)#1 (8) {
+ ["y"]=>
+ int(0)
+ ["m"]=>
+ int(0)
+ ["d"]=>
+ int(7)
+ ["h"]=>
+ int(0)
+ ["i"]=>
+ int(0)
+ ["s"]=>
+ int(0)
+ ["invert"]=>
+ int(0)
+ ["days"]=>
+ bool(false)
+}
+7
+(unknown)
diff --git a/ext/date/tests/bug50055.phpt b/ext/date/tests/bug50055.phpt
new file mode 100644
index 0000000..907bb93
--- /dev/null
+++ b/ext/date/tests/bug50055.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #50555 (DateTime::sub() allows 'relative' time modifications).
+--FILE--
+<?php
+$now = '2010-03-07 13:21:38 UTC';
+//positive DateInterval
+$da1 = date_create( $now );
+$ds1 = date_create( $now );
+$i = DateInterval::createFromDateString('third Tuesday of next month');
+echo $da1->format( DateTime::ISO8601 ), "\n";
+echo date_add($da1, $i)->format( DateTime::ISO8601 ), "\n";
+date_sub($ds1, $i);
+
+//negative DateInterval
+$da2 = date_create( $now );
+$ds2 = date_create( $now );
+$i2 = DateInterval::createFromDateString('third Tuesday of last month');
+echo $da2->format( DateTime::ISO8601 ), "\n";
+echo date_add($da2, $i2)->format( DateTime::ISO8601 ), "\n";//works
+date_sub($ds2, $i);
+?>
+--EXPECTF--
+2010-03-07T13:21:38+0000
+2010-04-20T13:21:38+0000
+
+Warning: date_sub(): Only non-special relative time specifications are supported for subtraction in %sbug50055.php on line 9
+2010-03-07T13:21:38+0000
+2010-02-16T13:21:38+0000
+
+Warning: date_sub(): Only non-special relative time specifications are supported for subtraction in %sbug50055.php on line 17
diff --git a/ext/date/tests/bug50392.phpt b/ext/date/tests/bug50392.phpt
new file mode 100644
index 0000000..9b10023
--- /dev/null
+++ b/ext/date/tests/bug50392.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #50392 (date_create_from_format enforces 6 digits for 'u' format character)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Bratislava');
+
+$base = '2009-03-01 18:00:00';
+
+for ($i = 0; $i < 8; $i++) {
+ $string = $base . '.' . str_repeat($i, $i);
+ echo $string, "\n- ";
+ $result = date_parse_from_format('Y-m-d H:i:s.u', $string);
+ echo $result['fraction'] ? $result['fraction'] : 'X', "\n";
+ foreach( $result['errors'] as $error ) {
+ echo "- ", $error, "\n";
+ }
+ echo "\n";
+}
+?>
+--EXPECT--
+2009-03-01 18:00:00.
+- X
+- Data missing
+
+2009-03-01 18:00:00.1
+- 0.1
+
+2009-03-01 18:00:00.22
+- 0.22
+
+2009-03-01 18:00:00.333
+- 0.333
+
+2009-03-01 18:00:00.4444
+- 0.4444
+
+2009-03-01 18:00:00.55555
+- 0.55555
+
+2009-03-01 18:00:00.666666
+- 0.666666
+
+2009-03-01 18:00:00.7777777
+- 0.777777
+- Trailing data
diff --git a/ext/date/tests/bug50475.phpt b/ext/date/tests/bug50475.phpt
new file mode 100644
index 0000000..454e86c
--- /dev/null
+++ b/ext/date/tests/bug50475.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #50475 (DateTime::setISODate followed by DateTime::setTime)
+--FILE--
+<?php
+date_default_timezone_set('Asia/Calcutta');
+
+$date = new DateTime('18-01-2009 00:00:00');
+
+$date->setISODate(2009, 6, 1);
+
+var_dump($date->format('Y-m-d H:i:s'));
+
+$date->setTime(8, 0);
+var_dump($date->format('Y-m-d H:i:s'));
+?>
+--EXPECT--
+string(19) "2009-02-02 00:00:00"
+string(19) "2009-02-02 08:00:00" \ No newline at end of file
diff --git a/ext/date/tests/bug50680.phpt b/ext/date/tests/bug50680.phpt
new file mode 100644
index 0000000..99b1381
--- /dev/null
+++ b/ext/date/tests/bug50680.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #50680 ("eighth" quantifier is not understood)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+var_dump(date("d", strtotime("March 1 eighth day 2009")));
+--EXPECT--
+string(2) "09"
diff --git a/ext/date/tests/bug51096.phpt b/ext/date/tests/bug51096.phpt
new file mode 100644
index 0000000..df31313
--- /dev/null
+++ b/ext/date/tests/bug51096.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Bug #51096 (Test for "first day" vs "first day of")
+--FILE--
+<?php
+$tests = array(
+ 'first day',
+ 'last day',
+ 'next month',
+ 'first day next month',
+ 'last day next month',
+ 'first day of next month',
+ 'last day of next month'
+);
+
+foreach ( $tests as $test )
+{
+ $result = date_parse( $test );
+ $rel = $result['relative'];
+ echo $test, "\n- month: ", $rel['month'], '; day: ', $rel['day'],
+ '; first-day-of: ', isset( $rel['first_day_of_month'] ) ? 'true' : 'false',
+ '; last-day-of: ', isset( $rel['last_day_of_month'] ) ? 'true' : 'false', "\n";
+ $date = new DateTime( '2010-03-06 15:21 UTC' );
+ echo '- ', $date->format( DateTime::ISO8601 );
+ $date->modify( $test );
+ echo ' -> ', $date->format( DateTime::ISO8601 ), "\n\n";
+}
+?>
+--EXPECT--
+first day
+- month: 0; day: 1; first-day-of: false; last-day-of: false
+- 2010-03-06T15:21:00+0000 -> 2010-03-07T15:21:00+0000
+
+last day
+- month: 0; day: -1; first-day-of: false; last-day-of: false
+- 2010-03-06T15:21:00+0000 -> 2010-03-05T15:21:00+0000
+
+next month
+- month: 1; day: 0; first-day-of: false; last-day-of: false
+- 2010-03-06T15:21:00+0000 -> 2010-04-06T15:21:00+0000
+
+first day next month
+- month: 1; day: 1; first-day-of: false; last-day-of: false
+- 2010-03-06T15:21:00+0000 -> 2010-04-07T15:21:00+0000
+
+last day next month
+- month: 1; day: -1; first-day-of: false; last-day-of: false
+- 2010-03-06T15:21:00+0000 -> 2010-04-05T15:21:00+0000
+
+first day of next month
+- month: 1; day: 0; first-day-of: true; last-day-of: false
+- 2010-03-06T15:21:00+0000 -> 2010-04-01T15:21:00+0000
+
+last day of next month
+- month: 1; day: 0; first-day-of: false; last-day-of: true
+- 2010-03-06T15:21:00+0000 -> 2010-04-30T15:21:00+0000
diff --git a/ext/date/tests/bug51393.phpt b/ext/date/tests/bug51393.phpt
new file mode 100644
index 0000000..e3f0983
--- /dev/null
+++ b/ext/date/tests/bug51393.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Bug #51393 (DateTime::createFromFormat() fails if format string contains timezone)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$dt = DateTime::createFromFormat('O', '+0800');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('P', '+08:00');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('O', '-0800');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('P', '-08:00');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('[O]', '[+0800]');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('[P]', '[+08:00]');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('[O]', '[-0800]');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('[P]', '[-08:00]');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('O', 'GMT+0800');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('P', 'GMT+08:00');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('O', 'GMT-0800');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('P', 'GMT-08:00');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('[O]', '[GMT+0800]');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('[P]', '[GMT+08:00]');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('[O]', '[GMT-0800]');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('[P]', '[GMT-08:00]');
+var_dump($dt->getOffset());
+
+$dt = DateTime::createFromFormat('O', 'invalid');
+var_dump($dt);
+?>
+--EXPECT--
+int(28800)
+int(28800)
+int(-28800)
+int(-28800)
+int(28800)
+int(28800)
+int(-28800)
+int(-28800)
+int(28800)
+int(28800)
+int(-28800)
+int(-28800)
+int(28800)
+int(28800)
+int(-28800)
+int(-28800)
+bool(false)
diff --git a/ext/date/tests/bug51819.phpt b/ext/date/tests/bug51819.phpt
new file mode 100644
index 0000000..37cab20
--- /dev/null
+++ b/ext/date/tests/bug51819.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #51819 (Case discrepancy in timezone names cause Uncaught exception and fatal error)
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$aTzAbbr = timezone_abbreviations_list();
+
+$aTz = array();
+foreach (array_keys($aTzAbbr) as $sKey) {
+ foreach (array_keys($aTzAbbr[$sKey]) as $iIndex) {
+ $sTz = $aTzAbbr[$sKey][$iIndex]['timezone_id'];
+
+ if (! in_array($sTz, $aTz)) {
+ array_push($aTz, $sTz);
+ }
+ }
+}
+
+foreach ($aTz as $sTz) {
+ $sDate = '2010-05-15 00:00:00 ' . $sTz;
+
+ try {
+ $oDateTime = new DateTime($sDate);
+ } catch (Exception $oException) {
+ var_dump($oException->getMessage());
+ print_r(DateTime::getLastErrors());
+ }
+}
+
+var_dump('this should be the only output');
+?>
+--EXPECTF--
+string(30) "this should be the only output"
diff --git a/ext/date/tests/bug51866.phpt b/ext/date/tests/bug51866.phpt
new file mode 100644
index 0000000..8d765b0
--- /dev/null
+++ b/ext/date/tests/bug51866.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Bug #51866 (Lenient parsing with parseFromFormat)
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+$tests = array(
+ array( 'Y-m-d', '2001-11-29 13:20:01' ),
+ array( 'Y-m-d+', '2001-11-29 13:20:01' ),
+ array( 'Y-m-d +', '2001-11-29 13:20:01' ),
+ array( 'Y-m-d+', '2001-11-29' ),
+ array( 'Y-m-d +', '2001-11-29' ),
+ array( 'Y-m-d +', '2001-11-29 ' ),
+);
+foreach( $tests as $test )
+{
+ list($format, $str) = $test;
+ var_dump($format, $str);
+ $d = DateTime::createFromFormat($format, $str);
+ var_dump($d);
+ var_dump(DateTime::getLastErrors());
+
+ echo "\n\n";
+}
+--EXPECTF--
+string(5) "Y-m-d"
+string(19) "2001-11-29 13:20:01"
+bool(false)
+array(4) {
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(1)
+ ["errors"]=>
+ array(1) {
+ [10]=>
+ string(13) "Trailing data"
+ }
+}
+
+
+string(6) "Y-m-d+"
+string(19) "2001-11-29 13:20:01"
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2001-11-29 %d:%d:%d"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(%d) "%s"
+}
+array(4) {
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [10]=>
+ string(13) "Trailing data"
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+}
+
+
+string(7) "Y-m-d +"
+string(19) "2001-11-29 13:20:01"
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2001-11-29 %d:%d:%d"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(%d) "%s"
+}
+array(4) {
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [11]=>
+ string(13) "Trailing data"
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+}
+
+
+string(6) "Y-m-d+"
+string(10) "2001-11-29"
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2001-11-29 %d:%d:%d"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(%d) "%s"
+}
+array(4) {
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+}
+
+
+string(7) "Y-m-d +"
+string(10) "2001-11-29"
+bool(false)
+array(4) {
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(1)
+ ["errors"]=>
+ array(1) {
+ [10]=>
+ string(12) "Data missing"
+ }
+}
+
+
+string(7) "Y-m-d +"
+string(11) "2001-11-29 "
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2001-11-29 %d:%d:%d"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(%d) "%s"
+}
+array(4) {
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+}
diff --git a/ext/date/tests/bug51994.phpt b/ext/date/tests/bug51994.phpt
new file mode 100644
index 0000000..2c456ba
--- /dev/null
+++ b/ext/date/tests/bug51994.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #51994 (date_parse_from_format is parsing invalid date using 'yz' format)
+--FILE--
+<?php
+$trans_date = '10153'; // 152nd day of year 2010 -> 03.06.2010
+$a_date = date_parse_from_format('yz', $trans_date);
+var_dump($a_date);
+?>
+--EXPECTF--
+array(12) {
+ ["year"]=>
+ int(2010)
+ ["month"]=>
+ int(6)
+ ["day"]=>
+ int(3)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
diff --git a/ext/date/tests/bug52062-64bit.phpt b/ext/date/tests/bug52062-64bit.phpt
new file mode 100644
index 0000000..e4a2a52
--- /dev/null
+++ b/ext/date/tests/bug52062-64bit.phpt
@@ -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"
diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt
new file mode 100644
index 0000000..1d81437
--- /dev/null
+++ b/ext/date/tests/bug52062.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimestamp) (32 bit)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE == 8) die('skip 32-bit only');
+?>
+--XFAIL--
+Waiting for resolution of the 32-bit case.
+--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());
+var_dump($d->format('U'));
+
+$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"
+bool(false)
+string(12) "100000000000"
+string(30) "2008-07-11 04:56:32 1215752192"
+int(1215752192)
+string(10) "1215752192"
diff --git a/ext/date/tests/bug52063.phpt b/ext/date/tests/bug52063.phpt
new file mode 100644
index 0000000..af9da9e
--- /dev/null
+++ b/ext/date/tests/bug52063.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #52063 (DateTime constructor's second argument doesn't have a null default value)
+--FILE--
+<?php
+date_default_timezone_set("Europe/Lisbon");
+$a = new DateTime("2009-01-01", null);
+echo $a->format(DateTime::COOKIE);
+echo "\n";
+$a = date_create("2009-01-01", null);
+echo $a->format(DateTime::COOKIE);
+echo "\n";
+?>
+--EXPECTF--
+Thursday, 01-Jan-09 00:00:00 WET
+Thursday, 01-Jan-09 00:00:00 WET
diff --git a/ext/date/tests/bug52113.phpt b/ext/date/tests/bug52113.phpt
new file mode 100644
index 0000000..a7d9339
--- /dev/null
+++ b/ext/date/tests/bug52113.phpt
@@ -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) {
+}
diff --git a/ext/date/tests/bug52290.phpt b/ext/date/tests/bug52290.phpt
new file mode 100644
index 0000000..78ede13
--- /dev/null
+++ b/ext/date/tests/bug52290.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #52290 (setDate, setISODate, setTime works wrong when DateTime created from timestamp)
+--FILE--
+<?php
+$tz = 'UTC';
+date_default_timezone_set($tz);
+
+$ts = strtotime('2006-01-01');
+$dt = new DateTime('@'.$ts);
+$dt->setTimezone(new DateTimeZone($tz));
+
+var_dump($dt->format('o-\WW-N | Y-m-d | H:i:s | U'));
+
+$dt->setISODate(2005, 52, 1);
+var_dump($dt->format('o-\WW-N | Y-m-d | H:i:s | U'));
+
+$dt->setDate(2007, 10, 10);
+var_dump($dt->format('o-\WW-N | Y-m-d | H:i:s | U'));
+
+$dt->setTime(20, 30, 40);
+var_dump($dt->format('o-\WW-N | Y-m-d | H:i:s | U'));
+?>
+--EXPECTF--
+string(47) "2005-W52-7 | 2006-01-01 | 00:00:00 | 1136073600"
+string(47) "2005-W52-1 | 2005-12-26 | 00:00:00 | 1135555200"
+string(47) "2007-W41-3 | 2007-10-10 | 00:00:00 | 1191974400"
+string(47) "2007-W41-3 | 2007-10-10 | 20:30:40 | 1192048240" \ No newline at end of file
diff --git a/ext/date/tests/bug52342.phpt b/ext/date/tests/bug52342.phpt
new file mode 100644
index 0000000..45534a2
--- /dev/null
+++ b/ext/date/tests/bug52342.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #52342 (DateTime setIsoDate results in wrong timestamp)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Berlin');
+$from = new DateTime();
+$from->setTime(0, 0, 0);
+$from->setISODate(2010, 28, 1); //Montag der 28ten Woche 2010
+
+echo $from->format('d.m.Y H:i'), "\n"; //A
+echo $from->getTimestamp(), "\n"; //B
+echo date('d.m.Y H:i', $from->getTimestamp()), "\n"; //C
+
+$from->add(new DateInterval('P0D'));
+echo $from->getTimestamp(), "\n"; //B
+echo date('d.m.Y H:i', $from->getTimestamp()), "\n"; //C
+?>
+--EXPECT--
+12.07.2010 00:00
+1278885600
+12.07.2010 00:00
+1278885600
+12.07.2010 00:00
diff --git a/ext/date/tests/bug52430.phpt b/ext/date/tests/bug52430.phpt
new file mode 100644
index 0000000..0f53708
--- /dev/null
+++ b/ext/date/tests/bug52430.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #52430 (date_parse parse 24:xx:xx as valid time)
+--FILE--
+<?php
+var_dump(date_parse('2010-1-1 24:59:59'));
+?>
+--EXPECT--
+array(12) {
+ ["year"]=>
+ int(2010)
+ ["month"]=>
+ int(1)
+ ["day"]=>
+ int(1)
+ ["hour"]=>
+ int(24)
+ ["minute"]=>
+ int(59)
+ ["second"]=>
+ int(59)
+ ["fraction"]=>
+ float(0)
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [18]=>
+ string(27) "The parsed time was invalid"
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
diff --git a/ext/date/tests/bug52454.phpt b/ext/date/tests/bug52454.phpt
new file mode 100644
index 0000000..e2a94dc
--- /dev/null
+++ b/ext/date/tests/bug52454.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #52454 (Relative dates and getTimestamp increments by one day)
+--FILE--
+<?php
+date_default_timezone_set('Europe/London');
+
+$endOfWeek = new DateTime('2010-07-27 09:46:49');
+$endOfWeek->modify('this week +6 days');
+
+echo $endOfWeek->format('Y-m-d H:i:s')."\n";
+echo $endOfWeek->format('U')."\n";
+
+/* Thar she blows! */
+echo $endOfWeek->getTimestamp()."\n";
+
+echo $endOfWeek->format('Y-m-d H:i:s')."\n";
+?>
+--EXPECT--
+2010-08-01 09:46:49
+1280652409
+1280652409
+2010-08-01 09:46:49
diff --git a/ext/date/tests/bug52577.phpt b/ext/date/tests/bug52577.phpt
new file mode 100644
index 0000000..7a58f2a
--- /dev/null
+++ b/ext/date/tests/bug52577.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #52577 (Incorrect date returning)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Kiev');
+$date = '7.8.2010';
+echo "String: ".$date."\n";
+$date_format = DATE_RFC2822;
+$unixtime = strtotime($date);
+echo "Unixtime: ".$unixtime."\n";
+echo "Date(PHP): ".date($date_format,$unixtime)."\n";
+$date = new DateTime('@'.$unixtime);
+echo "DateTime(PHP Class): ".$date->format($date_format);
+?>
+--EXPECT--
+String: 7.8.2010
+Unixtime: 1281128400
+Date(PHP): Sat, 07 Aug 2010 00:00:00 +0300
+DateTime(PHP Class): Fri, 06 Aug 2010 21:00:00 +0000
diff --git a/ext/date/tests/bug52668.phpt b/ext/date/tests/bug52668.phpt
new file mode 100644
index 0000000..307a426
--- /dev/null
+++ b/ext/date/tests/bug52668.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #52668 (Iterating over a dateperiod twice is broken)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$start = new DateTime('20101212');
+$interval = DateInterval::createFromDateString('next day');
+$dp = new DatePeriod($start, $interval, 1);
+foreach($dp as $dt) {
+ echo $dt->format('r') . "\n"; // Sun, 12 Dec 2010 00:00:00 +0100
+}
+echo $start->format('r'), "\n";
+foreach($dp as $dt) {
+ echo $dt->format('r') . "\n"; // Sun, 12 Dec 2010 00:00:00 +0100
+}
+echo $start->format('r'), "\n\n";
+?>
+--EXPECT--
+Sun, 12 Dec 2010 00:00:00 +0000
+Mon, 13 Dec 2010 00:00:00 +0000
+Sun, 12 Dec 2010 00:00:00 +0000
+Sun, 12 Dec 2010 00:00:00 +0000
+Mon, 13 Dec 2010 00:00:00 +0000
+Sun, 12 Dec 2010 00:00:00 +0000
diff --git a/ext/date/tests/bug52738.phpt b/ext/date/tests/bug52738.phpt
new file mode 100644
index 0000000..fc1b602
--- /dev/null
+++ b/ext/date/tests/bug52738.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #52738 (Can't use new properties in class extended from DateInterval)
+--FILE--
+<?php
+class di extends DateInterval {
+ public $unit = 1;
+}
+
+$I = new di('P10D');
+echo $I->unit."\n";
+$I->unit++;
+echo $I->unit."\n";
+$I->unit = 42;
+echo $I->unit."\n";
+$I->d++;
+print_r($I);
+--EXPECT--
+1
+2
+42
+di Object
+(
+ [unit] => 42
+ [y] => 0
+ [m] => 0
+ [d] => 11
+ [h] => 0
+ [i] => 0
+ [s] => 0
+ [invert] => 0
+ [days] =>
+)
diff --git a/ext/date/tests/bug52808.phpt b/ext/date/tests/bug52808.phpt
new file mode 100644
index 0000000..e031ac6
--- /dev/null
+++ b/ext/date/tests/bug52808.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Bug #52808 (Segfault when specifying interval as two dates)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+$intervals = array(
+ "2008-05-11T15:30:00Z/2007-03-01T13:00:00Z",
+ "2007-05-11T15:30:00Z/2008-03-01T13:00:00Z",
+ "2007-05-11T15:30:00Z 2008-03-01T13:00:00Z",
+ "2007-05-11T15:30:00Z/",
+ "2007-05-11T15:30:00Z",
+ "2007-05-11T15:30:00Z/:00Z",
+);
+foreach($intervals as $iv) {
+ try
+ {
+ $di = new DateInterval($iv);
+ var_dump($di);
+ }
+ catch ( Exception $e )
+ {
+ echo $e->getMessage(), "\n";
+ }
+}
+echo "==DONE==\n";
+?>
+--EXPECTF--
+object(DateInterval)#%d (8) {
+ ["y"]=>
+ int(1)
+ ["m"]=>
+ int(2)
+ ["d"]=>
+ int(10)
+ ["h"]=>
+ int(2)
+ ["i"]=>
+ int(30)
+ ["s"]=>
+ int(0)
+ ["invert"]=>
+ int(1)
+ ["days"]=>
+ int(437)
+}
+object(DateInterval)#%d (8) {
+ ["y"]=>
+ int(0)
+ ["m"]=>
+ int(9)
+ ["d"]=>
+ int(18)
+ ["h"]=>
+ int(21)
+ ["i"]=>
+ int(30)
+ ["s"]=>
+ int(0)
+ ["invert"]=>
+ int(0)
+ ["days"]=>
+ int(294)
+}
+object(DateInterval)#%d (8) {
+ ["y"]=>
+ int(0)
+ ["m"]=>
+ int(9)
+ ["d"]=>
+ int(18)
+ ["h"]=>
+ int(21)
+ ["i"]=>
+ int(30)
+ ["s"]=>
+ int(0)
+ ["invert"]=>
+ int(0)
+ ["days"]=>
+ int(294)
+}
+DateInterval::__construct(): Failed to parse interval (2007-05-11T15:30:00Z/)
+DateInterval::__construct(): Failed to parse interval (2007-05-11T15:30:00Z)
+DateInterval::__construct(): Unknown or bad format (2007-05-11T15:30:00Z/:00Z)
+==DONE==
diff --git a/ext/date/tests/bug53437.phpt b/ext/date/tests/bug53437.phpt
new file mode 100644
index 0000000..f089866
--- /dev/null
+++ b/ext/date/tests/bug53437.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #53437 (Crash when using unserialized DatePeriod instance)
+--XFAIL--
+Bug #53437 Not fixed yet
+--FILE--
+<?php
+$dp = new DatePeriod(new DateTime('2010-01-01 UTC'), new DateInterval('P1D'), 2);
+
+echo "Original:\r\n";
+foreach($dp as $dt) {
+ echo $dt->format('Y-m-d H:i:s')."\r\n";
+}
+echo "\r\n";
+var_dump($dp);
+
+$ser = serialize($dp); // $ser is: O:10:"DatePeriod":0:{}
+
+// Create dangerous instance
+$dpu = unserialize($ser); // $dpu has invalid values???
+var_dump($dpu);
+
+echo "Unserialized:\r\n";
+// ???which leads to CRASH:
+foreach($dpu as $dt) {
+ echo $dt->format('Y-m-d H:i:s')."\r\n";
+}
+?>
+--EXPECT--
diff --git a/ext/date/tests/bug53502.phpt b/ext/date/tests/bug53502.phpt
new file mode 100644
index 0000000..6cfa5e0
--- /dev/null
+++ b/ext/date/tests/bug53502.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #53502 (strtotime with timezone memory leak)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+for ($i = 0; $i < 1000; $i++) {
+ strtotime('Monday 00:00 Europe/Paris'); // Memory leak
+}
+echo "Nothing, test only makes sense through valgrind.\n";
+?>
+--EXPECT--
+Nothing, test only makes sense through valgrind.
diff --git a/ext/date/tests/bug54283.phpt b/ext/date/tests/bug54283.phpt
new file mode 100644
index 0000000..780d0fa
--- /dev/null
+++ b/ext/date/tests/bug54283.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #54283 (new DatePeriod(NULL) causes crash)
+--FILE--
+<?php
+
+try {
+ var_dump(new DatePeriod(NULL));
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+string(51) "DatePeriod::__construct(): Unknown or bad format ()"
diff --git a/ext/date/tests/bug54316.phpt b/ext/date/tests/bug54316.phpt
new file mode 100644
index 0000000..a02288c
--- /dev/null
+++ b/ext/date/tests/bug54316.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #54316 (DateTime::createFromFormat does not handle trailing '|' correctly)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$dt = DateTime::createFromFormat('Y-m-d|', '2011-02-02');
+var_dump($dt);
+
+$dt = DateTime::createFromFormat('Y-m-d!', '2011-02-02');
+var_dump($dt);
+--EXPECT--
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2011-02-02 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "1970-01-01 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
diff --git a/ext/date/tests/bug54340.phpt b/ext/date/tests/bug54340.phpt
new file mode 100644
index 0000000..7f00309
--- /dev/null
+++ b/ext/date/tests/bug54340.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Bug #54340 (DateTime::add() method bug)
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$interval = new DateInterval('P1D');
+
+$dt = new DateTime('first day of January 2011');
+var_dump($dt);
+
+$dt->add($interval);
+var_dump($dt);
+
+$dt = new DateTime('first day of January 2011');
+
+$dt->sub($interval);
+var_dump($dt);
+--EXPECT--
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2011-01-01 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2011-01-02 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2010-12-31 00:00:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
diff --git a/ext/date/tests/bug54597.phpt b/ext/date/tests/bug54597.phpt
new file mode 100644
index 0000000..d196adf
--- /dev/null
+++ b/ext/date/tests/bug54597.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #54597 (incorrect years for DateTime objects created with 4-digit years)
+--INI--
+date.timezone=Europe/London
+--FILE--
+<?php
+$tz = new DateTimeZone("Europe/Amsterdam");
+$dateObject = new DateTime( 'January 0099', $tz );
+echo $dateObject->format( 'Y' ), "\n";
+$dateObject = new DateTime( 'January 1, 0099', $tz );
+echo $dateObject->format( 'Y' ), "\n";
+$dateObject = new DateTime( '0099-01', $tz );
+echo $dateObject->format( 'Y' ), "\n";
+?>
+--EXPECT--
+0099
+0099
+0099
diff --git a/ext/date/tests/bug54851.phpt b/ext/date/tests/bug54851.phpt
new file mode 100644
index 0000000..84d18ba
--- /dev/null
+++ b/ext/date/tests/bug54851.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Bug #54851 (DateTime::createFromFormat() doesn't interpret "D")
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$date = new DateTime("2011-05-17T22:14:12");
+$date2 = DateTime::createFromFormat("D H i s", $date->format("D"). ' 0 00 00');
+echo $date->format("r"), "\n";
+echo $date2->format("r"), "\n";
+var_dump($date->format("D") == $date2->format("D"));
+
+// Verify that our implementation works regardless of position
+$datePre = DateTime::createFromFormat("!D d M Y", "Fri 17 may 2011");
+$datePost = DateTime::createFromFormat("!d M Y D", "17 may 2011 Fri");
+echo $datePre->format("r"), "\n";
+echo $datePost->format("r"), "\n";
+var_dump($datePre->format("Y-m-d") == $datePost->format("Y-m-d"));
+
+// Verify that our implementation is the same as for the constructor and
+// strtotime
+$date1 = new DateTime("Tuesday");
+$date2 = DateTime::createFromFormat("D H i s", "Tuesday 0 00 00");
+echo $date1->format('r'), "\n";
+echo $date2->format('r'), "\n";
+var_dump($date1->format('D') == $date2->format('D'));
+
+// - when the day is not the same as the day on the original date:
+$date1 = DateTime::createFromFormat("!D d M Y", "Fri 19 November 2011");
+$date2 = new DateTime("Fri 19 November 2011");
+echo $date1->format('r'), "\n";
+echo $date2->format('r'), "\n";
+var_dump($date1->format('Y-m-d') == $date2->format('Y-m-d'));
+
+// - when the day *is* the same as the day on the original date:
+$date1 = DateTime::createFromFormat("!D d M Y", "Sat 19 November 2011");
+$date2 = new DateTime("Sat 19 November 2011");
+echo $date1->format('r'), "\n";
+echo $date2->format('r'), "\n";
+var_dump($date1->format('Y-m-d') == $date2->format('Y-m-d'));
+?>
+--EXPECTF--
+Tue, 17 May 2011 22:14:12 +0000
+Tue, %d %s %d 00:00:00 +0000
+bool(true)
+Fri, 20 May 2011 00:00:00 +0000
+Fri, 20 May 2011 00:00:00 +0000
+bool(true)
+Tue, %d %s %d 00:00:00 +0000
+Tue, %d %s %d 00:00:00 +0000
+bool(true)
+Fri, 25 Nov 2011 00:00:00 +0000
+Fri, 25 Nov 2011 00:00:00 +0000
+bool(true)
+Sat, 19 Nov 2011 00:00:00 +0000
+Sat, 19 Nov 2011 00:00:00 +0000
+bool(true)
diff --git a/ext/date/tests/bug55253.phpt b/ext/date/tests/bug55253.phpt
new file mode 100644
index 0000000..5751cc1
--- /dev/null
+++ b/ext/date/tests/bug55253.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #55253 (DateTime::add() and sub() result -1 hour on objects with time zone type 2)
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+date_default_timezone_set('America/New_York');
+
+$interval = new DateInterval('PT2H1M');
+
+$date3 = new DateTime('2010-10-04 02:18:48');
+$date2 = new DateTime('2010-10-04 02:18:48 EDT');
+
+echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n";
+echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n";
+
+echo $interval->format('Add %h hours %i minutes') . "\n";
+$date3->add($interval);
+$date2->add($interval);
+
+echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n";
+echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n";
+
+// Try subtracting from expected result.
+$date3 = new DateTime('2010-10-04 04:19:48');
+$date2 = new DateTime('2010-10-04 04:19:48 EDT');
+
+echo $interval->format('Subtract %h hours %i minutes from expected') . "\n";
+$date3->sub($interval);
+$date2->sub($interval);
+
+echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n";
+echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n";
+
+?>
+--EXPECT--
+Zone Type 3: 2010-10-04 02:18:48 EDT
+Zone Type 2: 2010-10-04 02:18:48 EDT
+Add 2 hours 1 minutes
+Zone Type 3: 2010-10-04 04:19:48 EDT
+Zone Type 2: 2010-10-04 04:19:48 EDT
+Subtract 2 hours 1 minutes from expected
+Zone Type 3: 2010-10-04 02:18:48 EDT
+Zone Type 2: 2010-10-04 02:18:48 EDT
diff --git a/ext/date/tests/bug55397.phpt b/ext/date/tests/bug55397.phpt
new file mode 100644
index 0000000..efc09b5
--- /dev/null
+++ b/ext/date/tests/bug55397.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #55397 (comparsion of incomplete DateTime causes SIGSEGV)
+--INI--
+--FILE--
+<?php
+date_default_timezone_set('Europe/Prague');
+var_dump(unserialize('O:8:"DateTime":0:{}') == new DateTime);
+?>
+--EXPECTF--
+Warning: %s: Trying to compare an incomplete DateTime object in %s on line %d
+bool(false)
diff --git a/ext/date/tests/bug60236.phpt b/ext/date/tests/bug60236.phpt
new file mode 100644
index 0000000..faa0e16
--- /dev/null
+++ b/ext/date/tests/bug60236.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #60236 (TLA timezone dates are not converted properly from timestamp)
+--INI--
+date.timezone=America/New_York
+--FILE--
+<?php
+$t = new DateTime('2010-07-06 18:38:28 EDT');
+$ts = $t->format('U');
+var_dump($ts);
+$t->setTimestamp($ts);
+var_dump($t);
+?>
+--EXPECT--
+string(10) "1278455908"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2010-07-06 18:38:28"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "EDT"
+}
diff --git a/ext/date/tests/bug62500.phpt b/ext/date/tests/bug62500.phpt
new file mode 100644
index 0000000..6952332
--- /dev/null
+++ b/ext/date/tests/bug62500.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #62500 (Segfault in DateInterval class when extended)
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+class Crasher extends DateInterval {
+ public $foo;
+ public function __construct($time_spec) {
+ var_dump($this->foo);
+ $this->foo = 3;
+ var_dump($this->foo);
+ var_dump($this->{2});
+ parent::__construct($time_spec);
+ }
+}
+try {
+ $c = new Crasher('blah');
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+--EXPECTF--
+NULL
+int(3)
+
+Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d
+NULL
+string(%s) "DateInterval::__construct(): Unknown or bad format (blah)"
diff --git a/ext/date/tests/bug62561.phpt b/ext/date/tests/bug62561.phpt
new file mode 100644
index 0000000..0ed32c1
--- /dev/null
+++ b/ext/date/tests/bug62561.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #62561 Unixtimestamp may take on local times DST flag (this test will only be valid during EDT)
+--FILE--
+<?php
+$tz = new DateTimeZone('America/New_York');
+$ts = new DateTime('@1341115200', $tz);
+$int = new DateInterval('P1D');
+$dayFromTs = new DateTime('@1341115200', new DateTimeZone('America/New_York'));
+$dayFromTs->add($int);
+
+echo 'ts: '.$ts->format('Y-m-d H:i:s')."\n";
+echo 'day from ts: '.$dayFromTs->format('Y-m-d H:i:s')."\n";
+?>
+--EXPECT--
+ts: 2012-07-01 04:00:00
+day from ts: 2012-07-02 04:00:00
diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt
new file mode 100644
index 0000000..26de510
--- /dev/null
+++ b/ext/date/tests/bug62852.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #62852 (Unserialize invalid DateTime causes crash)
+--INI--
+date.timezone=GMT
+--XFAIL--
+bug is not fixed yet
+--FILE--
+<?php
+$s1 = 'O:8:"DateTime":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}';
+$s2 = 'O:3:"Foo":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}';
+
+global $foo;
+
+class Foo extends DateTime {
+ function __wakeup() {
+ global $foo;
+ $foo = $this;
+ parent::__wakeup();
+ }
+}
+
+// Old test case
+try {
+ unserialize( $s1 );
+} catch ( Exception $e ) {}
+
+// My test case
+try {
+ unserialize( $s2 );
+} catch ( Exception $e ) {}
+var_dump( $foo );
+
+echo "okey";
+?>
+--EXPECTF--
+okey
diff --git a/ext/date/tests/bug62896.phpt b/ext/date/tests/bug62896.phpt
new file mode 100644
index 0000000..ccdcfb0
--- /dev/null
+++ b/ext/date/tests/bug62896.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #62896 Unixtimestamp may take on local times DST flag (this test will only be valid during CEST)
+--INI--
+date.timezone=Europe/Berlin
+--FILE--
+<?php
+ $tz = new DateTimeZone('Europe/Berlin');
+
+ echo "FROM TIMESTAMP, NO TZ:\n";
+
+ $date = new DateTime('@'.strtotime('2012-08-22 00:00:00 CEST'));
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ $date->modify('+0 days');
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ echo "FROM TIMESTAMP, WITH TZ:\n";
+
+ $date = new DateTime('@'.strtotime('2012-08-22 00:00:00 CEST'));
+ $date->setTimezone($tz);
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ $date->modify('+0 days');
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ echo "FROM STRING:\n";
+
+ $date = new DateTime('2012-08-22 00:00:00 CEST', $tz);
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ $date->modify('+0 days');
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+--EXPECT--
+FROM TIMESTAMP, NO TZ:
+2012-08-21 22:00:00 GMT+0000 (offset 0)
+2012-08-21 22:00:00 GMT+0000 (offset 0)
+FROM TIMESTAMP, WITH TZ:
+2012-08-22 00:00:00 CEST (offset 7200)
+2012-08-22 00:00:00 CEST (offset 7200)
+FROM STRING:
+2012-08-22 00:00:00 CEST (offset 7200)
+2012-08-22 00:00:00 CEST (offset 7200)
diff --git a/ext/date/tests/bug63435.phpt b/ext/date/tests/bug63435.phpt
new file mode 100644
index 0000000..dcec6e4
--- /dev/null
+++ b/ext/date/tests/bug63435.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #63435 Datetime::format('u') sometimes wrong by 1 microsecond
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+for ($i=1 ; $i<999 ; $i++) {
+ $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i));
+ $res = $datetime->format("u");
+ if ($res != $i) {
+ echo "$i != $res\n";
+ }
+}
+echo "Done";
+--EXPECT--
+Done
diff --git a/ext/date/tests/cal_days_in_month_invalid_calendar.phpt b/ext/date/tests/cal_days_in_month_invalid_calendar.phpt
new file mode 100644
index 0000000..3550b91
--- /dev/null
+++ b/ext/date/tests/cal_days_in_month_invalid_calendar.phpt
@@ -0,0 +1,16 @@
+--TEST--
+cal_days_in_month: test invalid parameter
+--CREDITS--
+Havard Eide <nucleuz@gmail.com>
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--SKIPIF--
+<?php if (!extension_loaded("calendar")) { echo "skip extension not available"; } ?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+echo cal_days_in_month(99,0, 2009);
+?>
+--EXPECTF--
+Warning: cal_days_in_month(): invalid calendar ID 99. in %s on line %d
+
diff --git a/ext/date/tests/cal_days_in_month_invalid_date.phpt b/ext/date/tests/cal_days_in_month_invalid_date.phpt
new file mode 100644
index 0000000..0315270
--- /dev/null
+++ b/ext/date/tests/cal_days_in_month_invalid_date.phpt
@@ -0,0 +1,16 @@
+--TEST--
+cal_days_in_month: test invalid parameter
+--CREDITS--
+Havard Eide <nucleuz@gmail.com>
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--SKIPIF--
+<?php if (!extension_loaded("calendar")) { echo "skip extension not available"; } ?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+echo cal_days_in_month(CAL_GREGORIAN,0, 2009);
+?>
+--EXPECTF--
+Warning: cal_days_in_month(): invalid date. in %s on line %d
+
diff --git a/ext/date/tests/checkdate_basic1.phpt b/ext/date/tests/checkdate_basic1.phpt
new file mode 100644
index 0000000..2937f29
--- /dev/null
+++ b/ext/date/tests/checkdate_basic1.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test date_create() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool checkdate ( int $month , int $day , int $year )
+ * Description: Checks the validity of the date formed by the arguments.
+ * A date is considered valid if each parameter is properly defined.
+ * Source code: ext/date/php_date.c
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing checkdate() : basic functionality ***\n";
+
+echo "-- The following are all valid dates --\n";
+var_dump( checkdate(1, 1, 2009) );
+var_dump( checkdate(12, 31, 2009) );
+var_dump( checkdate(7, 2, 1963) );
+var_dump( checkdate(5, 31, 2009) );
+var_dump( checkdate(2, 28, 2009) ); // non-leap year
+var_dump( checkdate(2, 29, 2008) ); // leap year
+var_dump( checkdate(7, 2, 1) ); // min year
+var_dump( checkdate(7, 2, 32767) ); // max year
+
+echo "-- The following are all invalid dates --\n";
+var_dump( checkdate(13, 1, 2009) );
+var_dump( checkdate(2, 31, 2009) );
+var_dump( checkdate(1, 32, 2009) );
+var_dump( checkdate(2, 29, 2009) ); // non-leap year
+var_dump( checkdate(7, 2, 32768) ); // >max year
+var_dump( checkdate(7, 2, 0) ); // <min year
+
+?>
+===DONE===
+--EXPECT--
+*** Testing checkdate() : basic functionality ***
+-- The following are all valid dates --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+-- The following are all invalid dates --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/checkdate_error.phpt b/ext/date/tests/checkdate_error.phpt
new file mode 100644
index 0000000..4546408
--- /dev/null
+++ b/ext/date/tests/checkdate_error.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test checkdate() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool checkdate ( int $month , int $day , int $year )
+ * Description: Validate a Gregorian date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing checkdate() : error conditions ***\n";
+
+//Set the default time zone
+date_default_timezone_set("America/Chicago");
+
+$arg_0 = 1;
+$arg_1 = 1;
+$arg_2 = 1;
+$extra_arg = 1;
+
+echo "\n-- Testing checkdate() function with more than expected no. of arguments --\n";
+var_dump (checkdate($arg_0, $arg_1, $arg_2, $extra_arg));
+
+echo "\n-- Testing checkdate() function with less than expected no. of arguments --\n";
+var_dump (checkdate());
+var_dump (checkdate($arg_0));
+var_dump (checkdate($arg_0, $arg_1));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing checkdate() : error conditions ***
+
+-- Testing checkdate() function with more than expected no. of arguments --
+
+Warning: checkdate() expects exactly 3 parameters, 4 given in %s on line %d
+bool(false)
+
+-- Testing checkdate() function with less than expected no. of arguments --
+
+Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: checkdate() expects exactly 3 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: checkdate() expects exactly 3 parameters, 2 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/checkdate_variation1.phpt b/ext/date/tests/checkdate_variation1.phpt
new file mode 100644
index 0000000..378270c
--- /dev/null
+++ b/ext/date/tests/checkdate_variation1.phpt
@@ -0,0 +1,202 @@
+--TEST--
+Test checkdate() function : usage variation - Passing unexpected values to first argument $month.
+--FILE--
+<?php
+/* Prototype : bool checkdate ( int $month , int $day , int $year )
+ * Description: Checks the validity of the date formed by the arguments.
+ * A date is considered valid if each parameter is properly defined.
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing checkdate() : usage variation - unexpected values to first argument \$month***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$day = 2;
+$year = 1963;
+
+foreach($inputs as $variation =>$month) {
+ echo "\n-- $variation --\n";
+ var_dump( checkdate($month, $day, $year) );
+};
+
+// closing the resource
+fclose( $file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing checkdate() : usage variation - unexpected values to first argument $month***
+
+-- float 10.5 --
+bool(true)
+
+-- float -10.5 --
+bool(false)
+
+-- float .5 --
+bool(false)
+
+-- empty array --
+
+Warning: checkdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: checkdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: checkdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: checkdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+bool(false)
+
+-- lowercase null --
+bool(false)
+
+-- lowercase true --
+bool(true)
+
+-- lowercase false --
+bool(false)
+
+-- uppercase TRUE --
+bool(true)
+
+-- uppercase FALSE --
+bool(false)
+
+-- empty string DQ --
+
+Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: checkdate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: checkdate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+bool(false)
+
+-- unset var --
+bool(false)
+
+-- resource --
+
+Warning: checkdate() expects parameter 1 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/checkdate_variation2.phpt b/ext/date/tests/checkdate_variation2.phpt
new file mode 100644
index 0000000..76afbdc
--- /dev/null
+++ b/ext/date/tests/checkdate_variation2.phpt
@@ -0,0 +1,202 @@
+--TEST--
+Test checkdate() function : usage variation - Passing unexpected values to second argument $day.
+--FILE--
+<?php
+/* Prototype : bool checkdate ( int $month , int $day , int $year )
+ * Description: Checks the validity of the date formed by the arguments.
+ * A date is considered valid if each parameter is properly defined.
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing checkdate() : usage variation - unexpected values to second argument \$day***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$month = 7;
+$year = 1963;
+
+foreach($inputs as $variation =>$day) {
+ echo "\n-- $variation --\n";
+ var_dump( checkdate($month, $day, $year) );
+};
+
+// closing the resource
+fclose( $file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing checkdate() : usage variation - unexpected values to second argument $day***
+
+-- float 10.5 --
+bool(true)
+
+-- float -10.5 --
+bool(false)
+
+-- float .5 --
+bool(false)
+
+-- empty array --
+
+Warning: checkdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: checkdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: checkdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: checkdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+bool(false)
+
+-- lowercase null --
+bool(false)
+
+-- lowercase true --
+bool(true)
+
+-- lowercase false --
+bool(false)
+
+-- uppercase TRUE --
+bool(true)
+
+-- uppercase FALSE --
+bool(false)
+
+-- empty string DQ --
+
+Warning: checkdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: checkdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: checkdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: checkdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: checkdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: checkdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: checkdate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: checkdate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+bool(false)
+
+-- unset var --
+bool(false)
+
+-- resource --
+
+Warning: checkdate() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/checkdate_variation3.phpt b/ext/date/tests/checkdate_variation3.phpt
new file mode 100644
index 0000000..b946056
--- /dev/null
+++ b/ext/date/tests/checkdate_variation3.phpt
@@ -0,0 +1,201 @@
+--TEST--
+Test checkdate() function : usage variation - Passing unexpected values to third argument $year.
+--FILE--
+<?php
+/* Prototype : bool checkdate ( int $month , int $day , int $year )
+ * Description: Checks the validity of the date formed by the arguments.
+ * A date is considered valid if each parameter is properly defined.
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing checkdate() : usage variation - unexpected values to third argument \$year***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$day = 2;
+$month = 7;
+
+foreach($inputs as $variation =>$year) {
+ echo "\n-- $variation --\n";
+ var_dump( checkdate($month, $day, $year) );
+};
+
+// closing the resource
+fclose( $file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing checkdate() : usage variation - unexpected values to third argument $year***
+
+-- float 10.5 --
+bool(true)
+
+-- float -10.5 --
+bool(false)
+
+-- float .5 --
+bool(false)
+
+-- empty array --
+
+Warning: checkdate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: checkdate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: checkdate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: checkdate() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+bool(false)
+
+-- lowercase null --
+bool(false)
+
+-- lowercase true --
+bool(true)
+
+-- lowercase false --
+bool(false)
+
+-- uppercase TRUE --
+bool(true)
+
+-- uppercase FALSE --
+bool(false)
+
+-- empty string DQ --
+
+Warning: checkdate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: checkdate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: checkdate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: checkdate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: checkdate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: checkdate() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: checkdate() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: checkdate() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+bool(false)
+
+-- unset var --
+bool(false)
+
+-- resource --
+
+Warning: checkdate() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date-lenient-create.phpt b/ext/date/tests/date-lenient-create.phpt
new file mode 100644
index 0000000..49ee3c1
--- /dev/null
+++ b/ext/date/tests/date-lenient-create.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Test for + character in date format
+--FILE--
+<?php
+$tz = new DateTimeZone("UTC");
+$date = "06/08/04 12:00";
+echo "==\n";
+print_r( date_create_from_format( 'm/d/y', $date , $tz) );
+print_r( date_get_last_errors() );
+echo "==\n";
+print_r( date_create_from_format( 'm/d/y+', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+print_r( date_create_from_format( '+m/d/y', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+print_r( date_create_from_format( 'm/d/y++', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+
+$date = "06/08/04";
+print_r( date_create_from_format( 'm/d/y+', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+print_r( date_create_from_format( '+m/d/y', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+
+?>
+--EXPECT--
+==
+Array
+(
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 1
+ [errors] => Array
+ (
+ [8] => Trailing data
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
diff --git a/ext/date/tests/date-lenient.phpt b/ext/date/tests/date-lenient.phpt
new file mode 100644
index 0000000..e5862e1
--- /dev/null
+++ b/ext/date/tests/date-lenient.phpt
@@ -0,0 +1,146 @@
+--TEST--
+Test for + character in date format
+--FILE--
+<?php
+$date = "06/08/04 12:00";
+print_r( date_parse_from_format( 'm/d/y', $date ) );
+print_r( date_parse_from_format( 'm/d/y+', $date ) );
+print_r( date_parse_from_format( '+m/d/y', $date ) );
+print_r( date_parse_from_format( 'm/d/y++', $date ) );
+
+$date = "06/08/04";
+print_r( date_parse_from_format( 'm/d/y+', $date ) );
+print_r( date_parse_from_format( '+m/d/y', $date ) );
+
+?>
+--EXPECT--
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 1
+ [errors] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
diff --git a/ext/date/tests/date-parse-by-format001.phpt b/ext/date/tests/date-parse-by-format001.phpt
new file mode 100644
index 0000000..66975e9
--- /dev/null
+++ b/ext/date/tests/date-parse-by-format001.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test for date_parse_by_format()
+--FILE--
+<?php
+$date = "06/08/04";
+print_r( date_parse_from_format( '!m/d/y', $date ) );
+print_r( date_parse_from_format( '!m*d*y', $date ) );
+?>
+--EXPECT--
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] => 0
+ [minute] => 0
+ [second] => 0
+ [fraction] => 0
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] => 0
+ [minute] => 0
+ [second] => 0
+ [fraction] => 0
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
diff --git a/ext/date/tests/date-set-timestamp.phpt b/ext/date/tests/date-set-timestamp.phpt
new file mode 100644
index 0000000..c799b36
--- /dev/null
+++ b/ext/date/tests/date-set-timestamp.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DateTime::setTimestamp()
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+$d = new DateTime( '@1217184864' );
+echo $d->format( "Y-m-d H:i e\n" );
+
+$d = new DateTime();
+$d->setTimestamp( 1217184864 );
+echo $d->format( "Y-m-d H:i e\n" );
+?>
+--EXPECT--
+2008-07-27 18:54 +00:00
+2008-07-27 20:54 Europe/Oslo
diff --git a/ext/date/tests/date-time-modify-times.phpt b/ext/date/tests/date-time-modify-times.phpt
new file mode 100644
index 0000000..258ddbd
--- /dev/null
+++ b/ext/date/tests/date-time-modify-times.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test for DateTime::modify() with absolute time statements
+--INI--
+date.timezone=Europe/London
+--FILE--
+<?php
+$tests = array(
+ '2010-12-15 19:42:45 UTC' => array(
+ 'october 23:00', // October 23rd, with a broken time
+ 'back of 4pm',
+ 'next week monday',
+ 'next week monday 10am',
+ 'tuesday noon',
+ 'first monday of January 2011',
+ 'first monday of January 2011 09:00',
+ ),
+ '2010-12-15 19:42:45' => array(
+ 'october 23:00', // October 23rd, with a broken time
+ 'march 28, 00:15',
+ 'march 28, 01:15', // doesn't exist bcause of DST
+ 'march 28, 02:15',
+ ),
+);
+
+foreach ( $tests as $start => $data )
+{
+ foreach ( $data as $test )
+ {
+ echo date_create( $start )
+ ->modify( $test )
+ ->format( DateTime::RFC2822 ), "\n";
+ }
+}
+echo "\n";
+?>
+--EXPECT--
+Sat, 23 Oct 2010 00:00:00 +0000
+Wed, 15 Dec 2010 16:15:00 +0000
+Mon, 20 Dec 2010 00:00:00 +0000
+Mon, 20 Dec 2010 10:00:00 +0000
+Tue, 21 Dec 2010 12:00:00 +0000
+Mon, 03 Jan 2011 00:00:00 +0000
+Mon, 03 Jan 2011 09:00:00 +0000
+Sat, 23 Oct 2010 00:00:00 +0100
+Sun, 28 Mar 2010 00:15:00 +0000
+Sun, 28 Mar 2010 02:15:00 +0100
+Sun, 28 Mar 2010 02:15:00 +0100
diff --git a/ext/date/tests/date.phpt b/ext/date/tests/date.phpt
new file mode 100644
index 0000000..12bc9f0
--- /dev/null
+++ b/ext/date/tests/date.phpt
@@ -0,0 +1,22 @@
+--TEST--
+date() function
+--FILE--
+<?php
+$tmp = "cr";
+date_default_timezone_set('UTC');
+
+for($a = 0;$a < strlen($tmp); $a++){
+ echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
+}
+
+date_default_timezone_set("MET");
+
+for($a = 0;$a < strlen($tmp); $a++){
+ echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
+}
+?>
+--EXPECT--
+c: 2003-01-23T12:20:59+00:00
+r: Thu, 23 Jan 2003 12:20:59 +0000
+c: 2003-01-23T13:20:59+01:00
+r: Thu, 23 Jan 2003 13:20:59 +0100
diff --git a/ext/date/tests/date_add_basic.phpt b/ext/date/tests/date_add_basic.phpt
new file mode 100644
index 0000000..14a3d83
--- /dev/null
+++ b/ext/date/tests/date_add_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test date_add() function : basic functionality
+--CREDITS--
+Felix De Vliegher <felix.devliegher@gmail.com>
+--SKIPIF--
+<?php if (!function_exists('date_add')) echo "skip: date_add() function not found!"; ?>
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+/* Prototype : void date_add(DateTime object, DateInterval interval)
+ * Description: Adds an interval to the current date in object.
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_add() : basic functionality ***\n";
+
+// Initialise all required variables
+$startDate = '2008-01-01 12:25';
+$format = 'Y-m-d H:i:s';
+$intervals = array(
+ 'P3Y6M4DT12H30M5S',
+ 'P0D',
+ 'P2DT1M',
+ 'P1Y2MT23H43M150S'
+);
+
+$d = new DateTime($startDate);
+var_dump( $d->format($format) );
+
+foreach($intervals as $interval) {
+ date_add($d, new DateInterval($interval) );
+ var_dump( $d->format($format) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_add() : basic functionality ***
+string(19) "2008-01-01 12:25:00"
+string(19) "2011-07-06 00:55:05"
+string(19) "2011-07-06 00:55:05"
+string(19) "2011-07-08 00:56:05"
+string(19) "2012-09-09 00:41:35"
+===DONE===
diff --git a/ext/date/tests/date_add_basic2.phpt b/ext/date/tests/date_add_basic2.phpt
new file mode 100644
index 0000000..5beef23
--- /dev/null
+++ b/ext/date/tests/date_add_basic2.phpt
@@ -0,0 +1,14 @@
+--TEST--
+date_add() return false with wrong params
+--CREDITS--
+"Anna Filina" <afilina@phpquebec.org>
+#PHPTestFest2009 2009-05-02
+--INI--
+date.timezone=UTC
+display_errors=false
+--FILE--
+<?php
+var_dump(date_add()); // invalid parameters
+?>
+--EXPECT--
+bool(false) \ No newline at end of file
diff --git a/ext/date/tests/date_basic1.phpt b/ext/date/tests/date_basic1.phpt
new file mode 100644
index 0000000..f4d922b
--- /dev/null
+++ b/ext/date/tests/date_basic1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test date() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string date ( string $format [, int $timestamp ] )
+ * Description: Format a local time/date.
+ * Source code: ext/date/php_date.c
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date() : basic functionality ***\n";
+
+$timestamp = mktime(10, 44, 30, 2, 27, 2009);
+
+var_dump( date("F j, Y, g:i a", $timestamp) );
+var_dump( date("m.d.y", $timestamp) );
+var_dump( date("j, n, Y", $timestamp) );
+var_dump( date("Ymd", $timestamp) );
+var_dump( date('h-i-s, j-m-y, it is w Day', $timestamp) );
+var_dump( date('\i\t \i\s \t\h\e jS \d\a\y.', $timestamp) );
+var_dump( date("D M j G:i:s T Y", $timestamp) );
+var_dump( date('H:m:s \m \i\s\ \m\o\n\t\h', $timestamp) );
+var_dump( date("H:i:s", $timestamp) );
+
+?>
+===DONE===
+--EXPECT--
+*** Testing date() : basic functionality ***
+string(27) "February 27, 2009, 10:44 am"
+string(8) "02.27.09"
+string(11) "27, 2, 2009"
+string(8) "20090227"
+string(39) "10-44-30, 27-02-09, 4428 4430 5 Friam09"
+string(19) "it is the 27th day."
+string(28) "Fri Feb 27 10:44:30 GMT 2009"
+string(19) "10:02:30 m is month"
+string(8) "10:44:30"
+===DONE===
+
diff --git a/ext/date/tests/date_constants.phpt b/ext/date/tests/date_constants.phpt
new file mode 100644
index 0000000..132e241
--- /dev/null
+++ b/ext/date/tests/date_constants.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Date constants
+--FILE--
+<?php
+ date_default_timezone_set("Europe/Oslo");
+ $constants = array(
+ DATE_ATOM,
+ DATE_COOKIE,
+ DATE_ISO8601,
+ DATE_RFC822,
+ DATE_RFC850,
+ DATE_RFC1036,
+ DATE_RFC1123,
+ DATE_RFC2822,
+ DATE_RFC3339,
+ DATE_RSS,
+ DATE_W3C
+ );
+
+ foreach($constants as $const) {
+ var_dump(date($const, strtotime("1 Jul 06 14:27:30 +0200")));
+ var_dump(date($const, strtotime("2006-05-30T14:32:13+02:00")));
+ }
+
+ print "\n";
+
+ var_dump(
+ DATE_ATOM == DateTime::ATOM,
+ DATE_COOKIE == DateTime::COOKIE,
+ DATE_ISO8601 == DateTime::ISO8601,
+ DATE_RFC822 == DateTime::RFC822,
+ DATE_RFC850 == DateTime::RFC850,
+ DATE_RFC1036 == DateTime::RFC1036,
+ DATE_RFC1123 == DateTime::RFC1123,
+ DATE_RFC2822 == DateTime::RFC2822,
+ DATE_RFC3339 == DateTime::RFC3339,
+ DATE_RSS == DateTime::RSS,
+ DATE_W3C == DateTime::W3C
+ );
+?>
+--EXPECT--
+string(25) "2006-07-01T14:27:30+02:00"
+string(25) "2006-05-30T14:32:13+02:00"
+string(33) "Saturday, 01-Jul-06 14:27:30 CEST"
+string(32) "Tuesday, 30-May-06 14:32:13 CEST"
+string(24) "2006-07-01T14:27:30+0200"
+string(24) "2006-05-30T14:32:13+0200"
+string(29) "Sat, 01 Jul 06 14:27:30 +0200"
+string(29) "Tue, 30 May 06 14:32:13 +0200"
+string(33) "Saturday, 01-Jul-06 14:27:30 CEST"
+string(32) "Tuesday, 30-May-06 14:32:13 CEST"
+string(29) "Sat, 01 Jul 06 14:27:30 +0200"
+string(29) "Tue, 30 May 06 14:32:13 +0200"
+string(31) "Sat, 01 Jul 2006 14:27:30 +0200"
+string(31) "Tue, 30 May 2006 14:32:13 +0200"
+string(31) "Sat, 01 Jul 2006 14:27:30 +0200"
+string(31) "Tue, 30 May 2006 14:32:13 +0200"
+string(25) "2006-07-01T14:27:30+02:00"
+string(25) "2006-05-30T14:32:13+02:00"
+string(31) "Sat, 01 Jul 2006 14:27:30 +0200"
+string(31) "Tue, 30 May 2006 14:32:13 +0200"
+string(25) "2006-07-01T14:27:30+02:00"
+string(25) "2006-05-30T14:32:13+02:00"
+
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/date/tests/date_create-1.phpt b/ext/date/tests/date_create-1.phpt
new file mode 100644
index 0000000..365d54d
--- /dev/null
+++ b/ext/date/tests/date_create-1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+date_create() function [1]
+--SKIPIF--
+<?php if (!function_exists('date_create')) echo "SKIP"; ?>
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+$tz1 = timezone_open("GMT");
+$tz2 = timezone_open("Europe/London");
+$tz3 = timezone_open("America/Los_Angeles");
+$d = array();
+$d[] = date_create("2005-07-14 22:30:41");
+$d[] = date_create("2005-07-14 22:30:41 GMT");
+$d[] = date_create("2005-07-14 22:30:41 CET");
+$d[] = date_create("2005-07-14 22:30:41 CEST");
+$d[] = date_create("2005-07-14 22:30:41 Europe/Oslo");
+$d[] = date_create("2005-07-14 22:30:41 America/Los_Angeles");
+
+$d[] = date_create("2005-07-14 22:30:41", $tz1);
+$d[] = date_create("2005-07-14 22:30:41", $tz2);
+$d[] = date_create("2005-07-14 22:30:41", $tz3);
+
+$d[] = date_create("2005-07-14 22:30:41 GMT", $tz1);
+$d[] = date_create("2005-07-14 22:30:41 GMT", $tz2);
+$d[] = date_create("2005-07-14 22:30:41 GMT", $tz3);
+
+$d[] = date_create("2005-07-14 22:30:41 Europe/Oslo", $tz1);
+$d[] = date_create("2005-07-14 22:30:41 America/Los_Angeles", $tz2);
+
+foreach($d as $date) {
+ echo $date->format(DateTime::ISO8601), "\n";
+}
+?>
+--EXPECT--
+2005-07-14T22:30:41+0200
+2005-07-14T22:30:41+0000
+2005-07-14T22:30:41+0100
+2005-07-14T22:30:41+0200
+2005-07-14T22:30:41+0200
+2005-07-14T22:30:41-0700
+2005-07-14T22:30:41+0000
+2005-07-14T22:30:41+0100
+2005-07-14T22:30:41-0700
+2005-07-14T22:30:41+0000
+2005-07-14T22:30:41+0000
+2005-07-14T22:30:41+0000
+2005-07-14T22:30:41+0200
+2005-07-14T22:30:41-0700
diff --git a/ext/date/tests/date_create-2.phpt b/ext/date/tests/date_create-2.phpt
new file mode 100644
index 0000000..406a6b0
--- /dev/null
+++ b/ext/date/tests/date_create-2.phpt
@@ -0,0 +1,16 @@
+--TEST--
+date_create() function [2]
+--SKIPIF--
+<?php if (!function_exists('date_create')) echo "SKIP"; ?>
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+$d = date_create("2005-07-18 22:10:00 +0400");
+echo $d->format('D, d M Y H:i:s T'), "\n";
+
+$d = date_create("@1121710200 +0912");
+echo $d->format('D, d M Y H:i:s T'), "\n";
+?>
+--EXPECT--
+Mon, 18 Jul 2005 22:10:00 GMT+0400
+Mon, 18 Jul 2005 18:10:00 GMT+0000
diff --git a/ext/date/tests/date_create-relative.phpt b/ext/date/tests/date_create-relative.phpt
new file mode 100644
index 0000000..8a90931
--- /dev/null
+++ b/ext/date/tests/date_create-relative.phpt
@@ -0,0 +1,93 @@
+--TEST--
+date_create() with large relative offsets
+--FILE--
+<?php
+
+date_default_timezone_set('UTC');
+
+if (!defined('PHP_INT_MIN')) {
+ define('PHP_INT_MIN', intval(-PHP_INT_MAX - 1));
+}
+
+$base_time = '28 Feb 2008 12:00:00';
+
+// Most offsets tested in strtotime-relative.phpt. These are tests for dates outside the 32-bit range.
+$offsets = array(
+ // around 10 leap year periods (4000 years) in days
+ '1460000 days',
+ '1460969 days',
+ '1460970 days',
+ '1460971 days',
+ '1462970 days',
+
+ // around 1 leap year period in years
+ '398 years',
+ '399 years',
+ '400 years',
+ '401 years',
+
+ // around 40000 years
+ '39755 years',
+ '39999 years',
+ '40000 years',
+ '40001 years',
+ '41010 years',
+
+ // bigger than int (32-bit)
+ '10000000000 seconds',
+ '10000000000 minutes',
+ '10000000000 hours',
+ '10000000000 days',
+ '10000000000 months',
+ '10000000000 years',
+);
+
+foreach ($offsets AS $offset) {
+ foreach (array('+', '-') AS $direction) {
+ $dt = date_create("$base_time $direction$offset");
+ echo "$direction$offset: " . date_format($dt, DATE_ISO8601) . "\n";
+ }
+}
+
+?>
+--EXPECT--
++1460000 days: 6005-07-03T12:00:00+0000
+-1460000 days: -1990-10-25T12:00:00+0000
++1460969 days: 6008-02-27T12:00:00+0000
+-1460969 days: -1992-02-29T12:00:00+0000
++1460970 days: 6008-02-28T12:00:00+0000
+-1460970 days: -1992-02-28T12:00:00+0000
++1460971 days: 6008-02-29T12:00:00+0000
+-1460971 days: -1992-02-27T12:00:00+0000
++1462970 days: 6013-08-20T12:00:00+0000
+-1462970 days: -1998-09-07T12:00:00+0000
++398 years: 2406-02-28T12:00:00+0000
+-398 years: 1610-02-28T12:00:00+0000
++399 years: 2407-02-28T12:00:00+0000
+-399 years: 1609-02-28T12:00:00+0000
++400 years: 2408-02-28T12:00:00+0000
+-400 years: 1608-02-28T12:00:00+0000
++401 years: 2409-02-28T12:00:00+0000
+-401 years: 1607-02-28T12:00:00+0000
++39755 years: 41763-02-28T12:00:00+0000
+-39755 years: -37747-02-28T12:00:00+0000
++39999 years: 42007-02-28T12:00:00+0000
+-39999 years: -37991-02-28T12:00:00+0000
++40000 years: 42008-02-28T12:00:00+0000
+-40000 years: -37992-02-28T12:00:00+0000
++40001 years: 42009-02-28T12:00:00+0000
+-40001 years: -37993-02-28T12:00:00+0000
++41010 years: 43018-02-28T12:00:00+0000
+-41010 years: -39002-02-28T12:00:00+0000
++10000000000 seconds: 2325-01-18T05:46:40+0000
+-10000000000 seconds: 1691-04-09T18:13:20+0000
++10000000000 minutes: 21021-05-27T22:40:00+0000
+-10000000000 minutes: -17006-12-01T01:20:00+0000
++10000000000 hours: 1142802-09-30T04:00:00+0000
+-10000000000 hours: -1138787-07-28T20:00:00+0000
++10000000000 days: 27381078-03-25T12:00:00+0000
+-10000000000 days: -27377062-02-02T12:00:00+0000
++10000000000 months: 833335341-06-28T12:00:00+0000
+-10000000000 months: -833331326-10-28T12:00:00+0000
++10000000000 years: 10000002008-02-28T12:00:00+0000
+-10000000000 years: -9999997992-02-28T12:00:00+0000
diff --git a/ext/date/tests/date_create_basic.phpt b/ext/date/tests/date_create_basic.phpt
new file mode 100644
index 0000000..edec80b
--- /dev/null
+++ b/ext/date/tests/date_create_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test date_create() function : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTime date_create ([ string $time [, DateTimeZone $timezone ]] )
+ * Description: Returns new DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::__construct
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_create() : basic functionality ***\n";
+
+var_dump( date_create() );
+
+var_dump( date_create("GMT") );
+var_dump( date_create("2005-07-14 22:30:41") );
+var_dump( date_create("2005-07-14 22:30:41 GMT") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_create() : basic functionality ***
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "GMT"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/date_create_error.phpt b/ext/date/tests/date_create_error.phpt
new file mode 100644
index 0000000..0a42f28
--- /dev/null
+++ b/ext/date/tests/date_create_error.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test date_create() function : error conditions
+--FILE--
+<?php
+/* Prototype : DateTime date_create ([ string $time [, DateTimeZone $timezone ]] )
+ * Description: Returns new DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::__construct
+ */
+
+echo "*** Testing date_create() : error conditions ***\n";
+
+echo "\n-- Testing date_create() function with more than expected no. of arguments --\n";
+$time = "GMT";
+$timezone = timezone_open("GMT");
+$extra_arg = 99;
+var_dump( date_create($time, $timezone, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_create() : error conditions ***
+
+-- Testing date_create() function with more than expected no. of arguments --
+
+Warning: date_create() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_create_from_format_basic.phpt b/ext/date/tests/date_create_from_format_basic.phpt
new file mode 100644
index 0000000..592692b
--- /dev/null
+++ b/ext/date/tests/date_create_from_format_basic.phpt
@@ -0,0 +1,14 @@
+--TEST--
+date_create_from_format() return false with wrong params
+--CREDITS--
+"Anna Filina" <afilina@phpquebec.org>
+#PHPTestFest2009 2009-05-02
+--INI--
+date.timezone=UTC
+display_errors=false
+--FILE--
+<?php
+var_dump(date_create_from_format()); // invalid parameters
+?>
+--EXPECT--
+bool(false) \ No newline at end of file
diff --git a/ext/date/tests/date_create_from_format_basic2.phpt b/ext/date/tests/date_create_from_format_basic2.phpt
new file mode 100644
index 0000000..2b220a7
--- /dev/null
+++ b/ext/date/tests/date_create_from_format_basic2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+date_create_from_format() return false
+--CREDITS--
+"Anna Filina" <afilina@phpquebec.org>
+#PHPTestFest2009 2009-05-02
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+var_dump(date_create_from_format('Y-m-d', '2009---01')); // invalid date
+?>
+--EXPECT--
+bool(false) \ No newline at end of file
diff --git a/ext/date/tests/date_create_variation1.phpt b/ext/date/tests/date_create_variation1.phpt
new file mode 100644
index 0000000..f5fb2fd
--- /dev/null
+++ b/ext/date/tests/date_create_variation1.phpt
@@ -0,0 +1,389 @@
+--TEST--
+Test date_create() function : usage variation - Passing unexpected values to first argument $time.
+--FILE--
+<?php
+/* Prototype : DateTime date_create ([ string $time [, DateTimeZone $timezone ]] )
+ * Description: Returns new DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::__construct
+ */
+
+echo "*** Testing date_create() : usage variation - unexpected values to first argument \$time***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$timezone = new DateTimeZone("Europe/London");
+
+foreach($inputs as $variation =>$time) {
+ echo "\n-- $variation --\n";
+ var_dump( date_create($time) );
+ var_dump( date_create($time, $timezone) );
+};
+
+// closing the resource
+fclose( $file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_create() : usage variation - unexpected values to first argument $time***
+
+-- int 0 --
+bool(false)
+bool(false)
+
+-- int 1 --
+bool(false)
+bool(false)
+
+-- int 12345 --
+bool(false)
+bool(false)
+
+-- int -12345 --
+bool(false)
+bool(false)
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+bool(false)
+bool(false)
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_create() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: date_create() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_create() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: date_create() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_create() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: date_create() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_create() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: date_create() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+bool(false)
+bool(false)
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+bool(false)
+bool(false)
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string SQ --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- string DQ --
+bool(false)
+bool(false)
+
+-- string SQ --
+bool(false)
+bool(false)
+
+-- mixed case string --
+bool(false)
+bool(false)
+
+-- heredoc --
+bool(false)
+bool(false)
+
+-- instance of classWithToString --
+bool(false)
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_create() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: date_create() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_create() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+
+Warning: date_create() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_create_variation2.phpt b/ext/date/tests/date_create_variation2.phpt
new file mode 100644
index 0000000..c43ccb0
--- /dev/null
+++ b/ext/date/tests/date_create_variation2.phpt
@@ -0,0 +1,272 @@
+--TEST--
+Test date_create() function : usage variation - Passing unexpected values to second argument $timezone.
+--FILE--
+<?php
+/* Prototype : DateTime date_create ([ string $time [, DateTimeZone $timezone ]] )
+ * Description: Returns new DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::__construct
+ */
+
+echo "*** Testing date_create() : usage variation - unexpected values to second argument \$timezone***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$time = "2005-07-14 22:30:41";
+
+foreach($inputs as $variation =>$timezone) {
+ echo "\n-- $variation --\n";
+ var_dump( date_create($time, $timezone) );
+};
+
+// closing the resource
+fclose( $file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_create() : usage variation - unexpected values to second argument $timezone***
+
+-- int 0 --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2005-07-14 22:30:41"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_create() expects parameter 2 to be DateTimeZone, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_date_set_basic1.phpt b/ext/date/tests/date_date_set_basic1.phpt
new file mode 100644
index 0000000..6480212
--- /dev/null
+++ b/ext/date/tests/date_date_set_basic1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test date_date_set() function : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setDate
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_date_set() : basic functionality ***\n";
+
+$datetime = date_create("2009-01-30 19:34:10");
+
+echo date_format($datetime, DATE_RFC2822) . "\n";
+
+date_date_set($datetime, 2008, 02, 01);
+
+echo date_format($datetime, DATE_RFC2822) . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_date_set() : basic functionality ***
+Fri, 30 Jan 2009 19:34:10 +0000
+Fri, 01 Feb 2008 19:34:10 +0000
+===DONE===
diff --git a/ext/date/tests/date_date_set_error.phpt b/ext/date/tests/date_date_set_error.phpt
new file mode 100644
index 0000000..a44d36e
--- /dev/null
+++ b/ext/date/tests/date_date_set_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test date_date_set() function : error conditions
+--FILE--
+<?php
+/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setDate
+ */
+
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_date_set() : error conditions ***\n";
+
+echo "\n-- Testing date_date_set() function with zero arguments --\n";
+var_dump( date_date_set() );
+
+echo "\n-- Testing date_date_set() function with less than expected no. of arguments --\n";
+$datetime = date_create("2009-01-30 19:34:10");
+$year = 2009;
+$month = 1;
+$day = 30;
+var_dump( date_date_set($datetime) );
+var_dump( date_date_set($datetime, $year) );
+var_dump( date_date_set($datetime, $year, $month) );
+
+echo "\n-- Testing date_date_set() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( date_date_set($datetime, $year, $month, $day, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_date_set() : error conditions ***
+
+-- Testing date_date_set() function with zero arguments --
+
+Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_date_set() function with less than expected no. of arguments --
+
+Warning: date_date_set() expects exactly 4 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: date_date_set() expects exactly 4 parameters, 2 given in %s on line %d
+bool(false)
+
+Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d
+bool(false)
+
+-- Testing date_date_set() function with more than expected no. of arguments --
+
+Warning: date_date_set() expects exactly 4 parameters, 5 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_date_set_variation1.phpt b/ext/date/tests/date_date_set_variation1.phpt
new file mode 100644
index 0000000..29365b9
--- /dev/null
+++ b/ext/date/tests/date_date_set_variation1.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test date_date_set() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setDate
+ */
+
+echo "*** Testing date_date_set() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$day = 2;
+$month = 7;
+$year = 1963;
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( date_date_set($object, $year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_date_set() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_date_set() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_date_set_variation2.phpt b/ext/date/tests/date_date_set_variation2.phpt
new file mode 100644
index 0000000..384885c
--- /dev/null
+++ b/ext/date/tests/date_date_set_variation2.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_date_set() function : usage variation - Passing unexpected values to second argument $year.
+--FILE--
+<?php
+/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setDate
+ */
+
+echo "*** Testing date_date_set() : usage variation - unexpected values to second argument \$year***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-02-27 08:34:10");
+$day = 2;
+$month = 7;
+
+foreach($inputs as $variation =>$year) {
+ echo "\n-- $variation --\n";
+ var_dump( date_date_set($object, $year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_date_set() : usage variation - unexpected values to second argument $year***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(20) "12345-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(21) "-12345-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0010-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(20) "-0010-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_date_set() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_date_set() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_date_set() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_date_set() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-07-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_date_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_date_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_date_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_date_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_date_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_date_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_date_set() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_date_set() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(%d) "%s"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_date_set() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_date_set_variation3.phpt b/ext/date/tests/date_date_set_variation3.phpt
new file mode 100644
index 0000000..8070341
--- /dev/null
+++ b/ext/date/tests/date_date_set_variation3.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_date_set() function : usage variation - Passing unexpected values to third argument $month.
+--FILE--
+<?php
+/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setDate
+ */
+
+echo "*** Testing date_date_set() : usage variation - unexpected values to third argument \$month***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-02-27 08:34:10");
+$day = 2;
+$year = 1963;
+
+foreach($inputs as $variation =>$month) {
+ echo "\n-- $variation --\n";
+ var_dump( date_date_set($object, $year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_date_set() : usage variation - unexpected values to third argument $month***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2991-09-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0934-03-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-10-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-02-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_date_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_date_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_date_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_date_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_date_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_date_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_date_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_date_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_date_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_date_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_date_set() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_date_set() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-02 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_date_set() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_date_set_variation4.phpt b/ext/date/tests/date_date_set_variation4.phpt
new file mode 100644
index 0000000..4c7df3d
--- /dev/null
+++ b/ext/date/tests/date_date_set_variation4.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_date_set() function : usage variation - Passing unexpected values to forth argument $day.
+--FILE--
+<?php
+/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day )
+ * Description: Resets the current date of the DateTime object to a different date.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setDate
+ */
+
+echo "*** Testing date_date_set() : usage variation - unexpected values to forth argument \$day***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-02-27 08:34:10");
+$month = 7;
+$year = 1963;
+
+foreach($inputs as $variation =>$day) {
+ echo "\n-- $variation --\n";
+ var_dump( date_date_set($object, $year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_date_set() : usage variation - unexpected values to forth argument $day***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-07-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1997-04-17 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1929-09-11 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-07-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-20 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_date_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_date_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_date_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_date_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-07-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-07-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_date_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_date_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_date_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_date_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_date_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_date_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_date_set() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_date_set() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-06-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_date_set() expects parameter 4 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_default_timezone_get-1-win32.phpt b/ext/date/tests/date_default_timezone_get-1-win32.phpt
new file mode 100644
index 0000000..ed9ac1a
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get-1-win32.phpt
@@ -0,0 +1,24 @@
+--TEST--
+date_default_timezone_get() function [1]
+--SKIPIF--
+<?php
+ if(substr(PHP_OS, 0, 3) != 'WIN') die("skip skip on non windows");
+?>
+--INI--
+date.timezone=
+--FILE--
+<?php
+ putenv('TZ=');
+ echo date_default_timezone_get(), "\n";
+ echo date('e'), "\n";
+ /* The behaviour on windows is to select an arbitrary timezone name from the current system settings.
+ This gives no chance to hardcode the timezone name, for instance for UTC+1 it could choose
+ from the multiple names like Europe/Berlin or Europe/Paris . For this reason the test is
+ parametrized so there is no hardcoded timezone data.*/
+?>
+--EXPECTF--
+Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone '%s' for now, but please set date.timezone to select your timezone. in %s on line %d
+%s
+
+Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone '%s' for now, but please set date.timezone to select your timezone. in %s on line %d
+%s
diff --git a/ext/date/tests/date_default_timezone_get-1.phpt b/ext/date/tests/date_default_timezone_get-1.phpt
new file mode 100644
index 0000000..4bff31a
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get-1.phpt
@@ -0,0 +1,20 @@
+--TEST--
+date_default_timezone_get() function [1]
+--SKIPIF--
+<?php
+ if(substr(PHP_OS, 0, 3) == 'WIN') die("skip on windows");
+?>
+--INI--
+date.timezone=
+--FILE--
+<?php
+ putenv('TZ=');
+ echo date_default_timezone_get(), "\n";
+ echo date('e'), "\n";
+?>
+--EXPECTF--
+Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-1.php on line 3
+UTC
+
+Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-1.php on line 4
+UTC
diff --git a/ext/date/tests/date_default_timezone_get-2.phpt b/ext/date/tests/date_default_timezone_get-2.phpt
new file mode 100644
index 0000000..f58938d
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get-2.phpt
@@ -0,0 +1,16 @@
+--TEST--
+date_default_timezone_get() function [2]
+--SKIPIF--
+<?php
+ if(substr(PHP_OS, 0, 3) == 'WIN') die("skip on windows");
+?>
+--INI--
+date.timezone=
+--FILE--
+<?php
+ putenv('TZ=');
+ echo date_default_timezone_get(), "\n";
+?>
+--EXPECTF--
+Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-2.php on line 3
+UTC
diff --git a/ext/date/tests/date_default_timezone_get-3.phpt b/ext/date/tests/date_default_timezone_get-3.phpt
new file mode 100644
index 0000000..ffc882e
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get-3.phpt
@@ -0,0 +1,14 @@
+--TEST--
+date_default_timezone_get() function [3]
+--INI--
+date.timezone=Europe/Rome
+--FILE--
+<?php
+ echo date_default_timezone_get(), "\n";
+
+ date_default_timezone_set("America/Chicago");
+ echo date_default_timezone_get(), "\n";
+?>
+--EXPECT--
+Europe/Rome
+America/Chicago
diff --git a/ext/date/tests/date_default_timezone_get-4.phpt b/ext/date/tests/date_default_timezone_get-4.phpt
new file mode 100644
index 0000000..6d1982b
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get-4.phpt
@@ -0,0 +1,11 @@
+--TEST--
+date_default_timezone_get() function [4]
+--INI--
+date.timezone=Incorrect/Zone
+--FILE--
+<?php
+ echo date_default_timezone_get(), "\n";
+?>
+--EXPECTF--
+Warning: date_default_timezone_get(): Invalid date.timezone value 'Incorrect/Zone', we selected the timezone 'UTC' for now. in %sdate_default_timezone_get-4.php on line %d
+UTC
diff --git a/ext/date/tests/date_default_timezone_get_error.phpt b/ext/date/tests/date_default_timezone_get_error.phpt
new file mode 100644
index 0000000..1d96d18
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get_error.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test date_default_timezone_get() function : error conditions
+--FILE--
+<?php
+/* Prototype : string date_default_timezone_get ( void )
+ * Description: Gets the default timezone used by all date/time functions in a script.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_default_timezone_get() : error conditions ***\n";
+
+echo "\n-- Testing date_create() function with more than expected no. of arguments --\n";
+$extra_arg = 99;
+var_dump( date_default_timezone_get($extra_arg));
+
+?>
+
+===Done===
+--EXPECTF--
+*** Testing date_default_timezone_get() : error conditions ***
+
+-- Testing date_create() function with more than expected no. of arguments --
+string(3) "UTC"
+
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt
new file mode 100644
index 0000000..7afa2b1
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_set-1.phpt
@@ -0,0 +1,32 @@
+--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--
+<?php
+ putenv("TZ=");
+ $date1 = strtotime("2005-01-12 08:00:00");
+ $date2 = strtotime("2005-07-12 08:00:00");
+ date_default_timezone_set("America/Indiana/Knox");
+ $date3 = strtotime("2005-01-12 08:00:00");
+ $date4 = strtotime("2005-07-12 08:00:00");
+
+ echo date_default_timezone_get(), "\n";
+ echo date(DATE_ISO8601, $date1), "\n";
+ echo date(DATE_ISO8601, $date2), "\n";
+ echo date(DATE_ISO8601, $date3), "\n";
+ echo date(DATE_ISO8601, $date4), "\n";
+?>
+--EXPECTF--
+Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 3
+
+Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 4
+America/Indiana/Knox
+2005-01-12T03:00:00-0500
+2005-07-12T03:00:00-0500
+2005-01-12T08:00:00-0500
+2005-07-12T08:00:00-0500
diff --git a/ext/date/tests/date_default_timezone_set_error.phpt b/ext/date/tests/date_default_timezone_set_error.phpt
new file mode 100644
index 0000000..15c6aa6
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_set_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test date_default_timezone_set() function : error variations
+--FILE--
+<?php
+/* Prototype : bool date_default_timezone_set ( string $timezone_identifier )
+ * Description: Sets the default timezone used by all date/time functions in a script.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+echo "*** Testing date_default_timezone_set() : error variations ***\n";
+
+echo "\n-- Testing date_default_timezone_set() function with less than expected no. of arguments --\n";
+var_dump( date_default_timezone_set() );
+
+echo "\n-- Testing date_default_timezone_set() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( date_default_timezone_set("GMT", $extra_arg) );
+
+echo "\n-- Testing date_default_timezone_set() function with invalid timezone identifier --\n";
+var_dump( date_default_timezone_set("foo") );
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_default_timezone_set() : error variations ***
+
+-- Testing date_default_timezone_set() function with less than expected no. of arguments --
+
+Warning: date_default_timezone_set() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_default_timezone_set() function with more than expected no. of arguments --
+
+Warning: date_default_timezone_set() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing date_default_timezone_set() function with invalid timezone identifier --
+
+Notice: date_default_timezone_set(): Timezone ID 'foo' is invalid in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/date/tests/date_default_timezone_set_variation1.phpt b/ext/date/tests/date_default_timezone_set_variation1.phpt
new file mode 100644
index 0000000..22f4c22
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_set_variation1.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Test date_default_timezone_set() function : usage variations - Passing unexpected values for time_zone identifier
+--FILE--
+<?php
+/* Prototype : bool date_default_timezone_set ( string $timezone_identifier )
+ * Description: Sets the default timezone used by all date/time functions in a script.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+echo "*** Testing date_default_timezone_set() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of date_default_timezone_set()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(date_default_timezone_set($input));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECTF--
+*** Testing date_default_timezone_set() : usage variations ***
+
+-- Iteration 1 --
+
+Notice: date_default_timezone_set(): Timezone ID '0' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Notice: date_default_timezone_set(): Timezone ID '12345' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Notice: date_default_timezone_set(): Timezone ID '-2345' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Notice: date_default_timezone_set(): Timezone ID '10.5' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Notice: date_default_timezone_set(): Timezone ID '-10.5' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Notice: date_default_timezone_set(): Timezone ID '123456789000' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Notice: date_default_timezone_set(): Timezone ID '1.23456789E-9' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Notice: date_default_timezone_set(): Timezone ID '0.5' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: date_default_timezone_set() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Notice: date_default_timezone_set(): Timezone ID 'abcxyz' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Notice: date_default_timezone_set(): Timezone ID 'abcxyz' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Notice: date_default_timezone_set(): Timezone ID 'abc
+xyz' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: date_default_timezone_set() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/date/tests/date_diff.phpt b/ext/date/tests/date_diff.phpt
new file mode 100644
index 0000000..e01a94e
--- /dev/null
+++ b/ext/date/tests/date_diff.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Extensive test for date_diff().
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$ok = 0;
+define( 'COUNT', 120 );
+$d0 = new DateTime('2009-11-20');
+for ( $i = 0; $i < COUNT * 12; $i++ )
+{
+ $d = clone $d0;
+ $dates[$i] = $d->add( new DateInterval( "P{$i}D" ) );
+}
+
+for ( $i = 0; $i < COUNT; $i++)
+{
+// echo $dates[$i]->format( "Y-m-d\n" );
+ for ( $j = 0; $j < COUNT * 12; $j++)
+ {
+ $diff = date_diff( $dates[$i], $dates[$j] );
+ /*
+ printf( "\t%s %s %3d %s\n",
+ $dates[$i]->format( 'Y-m-d' ),
+ $dates[$j]->format( 'Y-m-d' ),
+ $diff->format( '%a' ),
+ $diff->format( '%y-%m-%d' )
+ );
+ */
+
+ $current = clone $dates[$i];
+ $int = new DateInterval( $diff->format( 'P%yY%mM%dD' ) );
+ if ( $current > $dates[$j] )
+ {
+ $current->sub( $int );
+ }
+ else
+ {
+ $current->add( $int );
+ }
+ if ( $current != $dates[$j] )
+ {
+ echo "FAIL: ",
+ $dates[$i]->format( 'Y-m-d' ), " + ",
+ $int->format( '%y-%m-%d' ), " = ",
+ $current->format( 'Y-m-d' ), " (",
+ $dates[$j]->format( 'Y-m-d' ), ")\n";
+ }
+ else
+ {
+ $ok++;
+ }
+ }
+}
+
+echo $ok, "\n";
+?>
+--EXPECT--
+172800
diff --git a/ext/date/tests/date_diff1.phpt b/ext/date/tests/date_diff1.phpt
new file mode 100644
index 0000000..cf32fcb
--- /dev/null
+++ b/ext/date/tests/date_diff1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test for date_diff with timezone abbreviations.
+--INI--
+date.timezone=Europe/London
+--FILE--
+<?php
+$start = new DateTime('2010-10-04 02:18:48 EDT');
+$end = new DateTime('2010-11-06 18:38:28 EDT');
+$int = $start->diff($end);
+var_dump($start);
+var_dump($end);
+var_dump($int);
+?>
+--EXPECT--
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2010-10-04 02:18:48"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "EDT"
+}
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2010-11-06 18:38:28"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "EDT"
+}
+object(DateInterval)#3 (8) {
+ ["y"]=>
+ int(0)
+ ["m"]=>
+ int(1)
+ ["d"]=>
+ int(2)
+ ["h"]=>
+ int(16)
+ ["i"]=>
+ int(19)
+ ["s"]=>
+ int(40)
+ ["invert"]=>
+ int(0)
+ ["days"]=>
+ int(33)
+}
diff --git a/ext/date/tests/date_error.phpt b/ext/date/tests/date_error.phpt
new file mode 100644
index 0000000..ee9b8f9
--- /dev/null
+++ b/ext/date/tests/date_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test date() function : error conditions
+--FILE--
+<?php
+/* Prototype : string date ( string $format [, int $timestamp ] )
+ * Description: Format a local time/date.
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date() : error conditions ***\n";
+
+//Set the default time zone
+date_default_timezone_set("America/Chicago");
+
+$format = "m.d.y";
+$timestamp = mktime(10, 44, 30, 2, 27, 2009);
+
+echo "\n-- Testing date function with no arguments --\n";
+var_dump (date());
+
+echo "\n-- Testing date function with more than expected no. of arguments --\n";
+$extra_arg = true;
+var_dump (checkdate($format, $timestamp, $extra_arg));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date() : error conditions ***
+
+-- Testing date function with no arguments --
+
+Warning: date() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date function with more than expected no. of arguments --
+
+Warning: checkdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_format_basic1.phpt b/ext/date/tests/date_format_basic1.phpt
new file mode 100644
index 0000000..dc55efb
--- /dev/null
+++ b/ext/date/tests/date_format_basic1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test date_format() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string date_format ( DateTime $object , string $format )
+ * Description: Returns date formatted according to given format
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::format
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_format() : basic functionality ***\n";
+$date = date_create("2005-07-14 22:30:41");
+
+var_dump( date_format($date, "F j, Y, g:i a") );
+var_dump( date_format($date, "m.d.y") );
+var_dump( date_format($date, "j, n, Y") );
+var_dump( date_format($date, "Ymd") );
+var_dump( date_format($date, 'h-i-s, j-m-y, it is w Day') );
+var_dump( date_format($date, '\i\t \i\s \t\h\e jS \d\a\y.') );
+var_dump( date_format($date, "D M j G:i:s T Y") );
+var_dump( date_format($date, 'H:m:s \m \i\s\ \m\o\n\t\h') );
+var_dump( date_format($date, "H:i:s") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_format() : basic functionality ***
+string(23) "July 14, 2005, 10:30 pm"
+string(8) "07.14.05"
+string(11) "14, 7, 2005"
+string(8) "20050714"
+string(39) "10-30-41, 14-07-05, 3031 3041 4 Thupm05"
+string(19) "it is the 14th day."
+string(28) "Thu Jul 14 22:30:41 BST 2005"
+string(19) "22:07:41 m is month"
+string(8) "22:30:41"
+===DONE===
diff --git a/ext/date/tests/date_format_error.phpt b/ext/date/tests/date_format_error.phpt
new file mode 100644
index 0000000..967695a
--- /dev/null
+++ b/ext/date/tests/date_format_error.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test date_format() function : error conditions
+--FILE--
+<?php
+/* Prototype : string date_format ( DateTime $object , string $format )
+ * Description: Returns date formatted according to given format
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::format
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_format() : error conditions ***\n";
+
+echo "\n-- Testing date_create() function with zero arguments --\n";
+var_dump( date_format() );
+
+$date = date_create("2005-07-14 22:30:41");
+
+echo "\n-- Testing date_create() function with less than expected no. of arguments --\n";
+var_dump( date_format($date) );
+
+echo "\n-- Testing date_create() function with more than expected no. of arguments --\n";
+$format = "F j, Y, g:i a";
+$extra_arg = 10;
+var_dump( date_format($date, $format, $extra_arg) );
+
+echo "\n-- Testing date_create() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( date_format($invalid_obj, $format) );
+$invalid_obj = 10;
+var_dump( date_format($invalid_obj, $format) );
+$invalid_obj = null;
+var_dump( date_format($invalid_obj, $format) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_format() : error conditions ***
+
+-- Testing date_create() function with zero arguments --
+
+Warning: date_format() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_create() function with less than expected no. of arguments --
+
+Warning: date_format() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing date_create() function with more than expected no. of arguments --
+
+Warning: date_format() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+
+-- Testing date_create() function with an invalid values for $object argument --
+
+Warning: date_format() expects parameter 1 to be DateTime, object given in %sp on line %d
+bool(false)
+
+Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_format_variation1.phpt b/ext/date/tests/date_format_variation1.phpt
new file mode 100644
index 0000000..025b7d3
--- /dev/null
+++ b/ext/date/tests/date_format_variation1.phpt
@@ -0,0 +1,252 @@
+--TEST--
+Test date_format() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : string date_format ( DateTime $object , string $format )
+ * Description: Returns date formatted according to given format
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::format
+ */
+
+echo "*** Testing date_format() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$format = 'H:m:s \m \i\s\ \m\o\n\t\h';
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( date_format($object, $format) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_format() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_format() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_format() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_format() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_format() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_format() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_format() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_format() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_format() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_format() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_format() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_format() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_format() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_format() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_format() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_format_variation2.phpt b/ext/date/tests/date_format_variation2.phpt
new file mode 100644
index 0000000..1a90951
--- /dev/null
+++ b/ext/date/tests/date_format_variation2.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test date_format() function : usage variation - Passing unexpected values to second argument $format.
+--FILE--
+<?php
+/* Prototype : string date_format ( DateTime $object , string $format )
+ * Description: Returns date formatted according to given format
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::format
+ */
+
+echo "*** Testing date_format() : usage variation - unexpected values to second argument \$format***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2005-07-14 22:30:41");
+
+foreach($inputs as $variation =>$format) {
+ echo "\n-- $variation --\n";
+ var_dump( date_format($object, $format) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_format() : usage variation - unexpected values to second argument $format***
+
+-- int 0 --
+string(1) "0"
+
+-- int 1 --
+string(1) "1"
+
+-- int 12345 --
+string(5) "12345"
+
+-- int -12345 --
+string(6) "-12345"
+
+-- float 10.5 --
+string(4) "10.5"
+
+-- float -10.5 --
+string(5) "-10.5"
+
+-- float .5 --
+string(3) "0.5"
+
+-- empty array --
+
+Warning: date_format() expects parameter 2 to be string, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_format() expects parameter 2 to be string, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_format() expects parameter 2 to be string, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_format() expects parameter 2 to be string, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+string(0) ""
+
+-- lowercase null --
+string(0) ""
+
+-- lowercase true --
+string(1) "1"
+
+-- lowercase false --
+string(0) ""
+
+-- uppercase TRUE --
+string(1) "1"
+
+-- uppercase FALSE --
+string(0) ""
+
+-- empty string DQ --
+string(0) ""
+
+-- empty string SQ --
+string(0) ""
+
+-- string DQ --
+string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710"
+
+-- string SQ --
+string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710"
+
+-- mixed case string --
+string(40) "41BSTThu, 14 Jul 2005 22:30:41 +01001722"
+
+-- heredoc --
+string(82) "10Europe/LondonThursdayThursday2005 42005Thu, 14 Jul 2005 22:30:41 +0100Thursday14"
+
+-- instance of classWithToString --
+string(66) "CThursdaypm4141 PM 2005b14Europe/London2005-07-14T22:30:41+01:0031"
+
+-- instance of classWithoutToString --
+
+Warning: date_format() expects parameter 2 to be string, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+string(0) ""
+
+-- unset var --
+string(0) ""
+
+-- resource --
+
+Warning: date_format() expects parameter 2 to be string, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_get_last_errors_basic.phpt b/ext/date/tests/date_get_last_errors_basic.phpt
new file mode 100644
index 0000000..5e83a52
--- /dev/null
+++ b/ext/date/tests/date_get_last_errors_basic.phpt
@@ -0,0 +1,13 @@
+--TEST--
+date_get_last_errors() return false
+--CREDITS--
+"Anna Filina" <afilina@phpquebec.org>
+#PHPTestFest2009 2009-05-02
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+var_dump(date_get_last_errors()); // no date was parsed, so no errors
+?>
+--EXPECT--
+bool(false) \ No newline at end of file
diff --git a/ext/date/tests/date_isodate_set_basic1.phpt b/ext/date/tests/date_isodate_set_basic1.phpt
new file mode 100644
index 0000000..dc8daba
--- /dev/null
+++ b/ext/date/tests/date_isodate_set_basic1.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test date_isodate_set() function : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setISODate
+ */
+
+echo "*** Testing date_isodate_set() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+// Create a deate object
+$datetime = date_create("2009-01-30 17:57:32");
+
+// Which month is week 40 ?
+date_isodate_set($datetime, 2008, 40);
+echo "Week 40 of 2009 is in \"" . date_format($datetime, "F") . "\"\n";
+
+// What date is week week 30 day 3 ?
+date_isodate_set($datetime, 2009, 30, 3);
+echo "Week 30 day 3 of 2009 is \"" . date_format($datetime, "D M j") . "\"\n";
+
+// What date was is last year ?
+date_isodate_set($datetime, 2008, 30, 3);
+echo "..same day last year was \"" . date_format($datetime, "D M j") . "\"\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_isodate_set() : basic functionality ***
+Week 40 of 2009 is in "September"
+Week 30 day 3 of 2009 is "Wed Jul 22"
+..same day last year was "Wed Jul 23"
+===DONE===
diff --git a/ext/date/tests/date_isodate_set_error.phpt b/ext/date/tests/date_isodate_set_error.phpt
new file mode 100644
index 0000000..9accd92
--- /dev/null
+++ b/ext/date/tests/date_isodate_set_error.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test date_isodate_set() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setISODate
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_isodate_set() : error conditions ***\n";
+
+echo "\n-- Testing date_isodate_set() function with zero arguments --\n";
+var_dump( date_isodate_set() );
+
+$datetime = date_create("2009-01-30 19:34:10");
+echo "\n-- Testing date_isodate_set() function with less than expected no. of arguments --\n";
+var_dump( date_isodate_set($datetime) );
+
+echo "\n-- Testing date_isodate_set() function with more than expected no. of arguments --\n";
+$year = 2009;
+$week = 30;
+$day = 7;
+$extra_arg = 30;
+var_dump( date_isodate_set($datetime, $year, $week, $day, $extra_arg) );
+
+echo "\n-- Testing date_isodate_set() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( date_isodate_set($invalid_obj, $year, $week, $day) );
+$invalid_obj = 10;
+var_dump( date_isodate_set($invalid_obj, $year, $week, $day) );
+$invalid_obj = null;
+var_dump( date_isodate_set($invalid_obj, $year, $week, $day) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_isodate_set() : error conditions ***
+
+-- Testing date_isodate_set() function with zero arguments --
+
+Warning: date_isodate_set() expects at least 3 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_isodate_set() function with less than expected no. of arguments --
+
+Warning: date_isodate_set() expects at least 3 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing date_isodate_set() function with more than expected no. of arguments --
+
+Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing date_isodate_set() function with an invalid values for $object argument --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_isodate_set_variation1.phpt b/ext/date/tests/date_isodate_set_variation1.phpt
new file mode 100644
index 0000000..a234d47
--- /dev/null
+++ b/ext/date/tests/date_isodate_set_variation1.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test date_isodate_set() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setISODate
+ */
+
+echo "*** Testing date_isodate_set() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$day = 2;
+$month = 7;
+$year = 1963;
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( date_isodate_set($object, $year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_isodate_set() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_isodate_set() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_isodate_set_variation2.phpt b/ext/date/tests/date_isodate_set_variation2.phpt
new file mode 100644
index 0000000..fa42a95
--- /dev/null
+++ b/ext/date/tests/date_isodate_set_variation2.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_isodate_set() function : usage variation - Passing unexpected values to second argument $year.
+--FILE--
+<?php
+/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setISODate
+ */
+
+echo "*** Testing date_isodate_set() : usage variation - unexpected values to second argument \$year***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-02-27 08:34:10");
+$day = 2;
+$month = 7;
+
+foreach($inputs as $variation =>$year) {
+ echo "\n-- $variation --\n";
+ var_dump( date_isodate_set($object, $year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_isodate_set() : usage variation - unexpected values to second argument $year***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-02-13 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(20) "12345-02-13 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(21) "-12345-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0010-02-16 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(20) "-0010-02-19 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_isodate_set() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_isodate_set() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_isodate_set() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_isodate_set() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-02-13 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0001-02-13 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_isodate_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_isodate_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_isodate_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_isodate_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_isodate_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_isodate_set() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_isodate_set() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_isodate_set() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "0000-02-15 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_isodate_set() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_isodate_set_variation3.phpt b/ext/date/tests/date_isodate_set_variation3.phpt
new file mode 100644
index 0000000..eeb8471
--- /dev/null
+++ b/ext/date/tests/date_isodate_set_variation3.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_isodate_set() function : usage variation - Passing unexpected values to third argument $week.
+--FILE--
+<?php
+/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setISODate
+ */
+
+echo "*** Testing date_isodate_set() : usage variation - unexpected values to third argument \$week***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-02-27 08:34:10");
+$day = 2;
+$year = 1963;
+
+foreach($inputs as $variation =>$month) {
+ echo "\n-- $variation --\n";
+ var_dump( date_isodate_set($object, $year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_isodate_set() : usage variation - unexpected values to third argument $week***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2199-07-30 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1726-05-21 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-03-05 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-10-16 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_isodate_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_isodate_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_isodate_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_isodate_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-01 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_isodate_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_isodate_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_isodate_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_isodate_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_isodate_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_isodate_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_isodate_set() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_isodate_set() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1962-12-25 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_isodate_set() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_isodate_set_variation4.phpt b/ext/date/tests/date_isodate_set_variation4.phpt
new file mode 100644
index 0000000..5da3c03
--- /dev/null
+++ b/ext/date/tests/date_isodate_set_variation4.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_isodate_set() function : usage variation - Passing unexpected values to forth argument $day.
+--FILE--
+<?php
+/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] )
+ * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setISODate
+ */
+
+echo "*** Testing date_isodate_set() : usage variation - unexpected values to forth argument \$day***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-02-27 08:34:10");
+$year = 1963;
+$month = 7;
+
+foreach($inputs as $variation =>$day) {
+ echo "\n-- $variation --\n";
+ var_dump( date_isodate_set($object, $year, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_isodate_set() : usage variation - unexpected values to forth argument $day***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-11 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1996-11-28 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1929-04-24 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-20 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-01-31 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_isodate_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_isodate_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_isodate_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_isodate_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-11 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-11 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_isodate_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_isodate_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_isodate_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_isodate_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_isodate_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_isodate_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_isodate_set() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_isodate_set() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "1963-02-10 08:34:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_isodate_set() expects parameter 4 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_modify-1.phpt b/ext/date/tests/date_modify-1.phpt
new file mode 100644
index 0000000..7707b7f
--- /dev/null
+++ b/ext/date/tests/date_modify-1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+date_modify() function [1]
+--SKIPIF--
+<?php if (!function_exists('date_create')) echo "SKIP"; ?>
+--FILE--
+<?php
+date_default_timezone_set("Pacific/Kwajalein");
+$ts = date_create("Thu Aug 19 1993 23:59:59");
+echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
+$ts->modify("+1 second");
+echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
+
+date_default_timezone_set("Europe/Amsterdam");
+$ts = date_create("Sun Mar 27 01:59:59 2005");
+echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
+$ts->modify("+1 second");
+echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
+
+$ts = date_create("Sun Oct 30 01:59:59 2005");
+echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
+$ts->modify("+ 1 hour 1 second");
+echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
+?>
+--EXPECT--
+Thu, 19 Aug 1993 23:59:59 KWAT
+Sat, 21 Aug 1993 00:00:00 MHT
+Sun, 27 Mar 2005 01:59:59 CET
+Sun, 27 Mar 2005 03:00:00 CEST
+Sun, 30 Oct 2005 01:59:59 CEST
+Sun, 30 Oct 2005 03:00:00 CET
diff --git a/ext/date/tests/date_modify-2.phpt b/ext/date/tests/date_modify-2.phpt
new file mode 100644
index 0000000..cc197fc
--- /dev/null
+++ b/ext/date/tests/date_modify-2.phpt
@@ -0,0 +1,15 @@
+--TEST--
+date_modify() function [2]
+--SKIPIF--
+<?php if (!function_exists('date_create')) echo "SKIP"; ?>
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+$d = date_create("2005-07-18 22:10:00 +0400");
+echo date_format($d, 'D, d M Y H:i:s T'), "\n";
+date_modify($d, "+1 hour");
+echo date_format($d, 'D, d M Y H:i:s T'), "\n";
+?>
+--EXPECT--
+Mon, 18 Jul 2005 22:10:00 GMT+0400
+Mon, 18 Jul 2005 23:10:00 GMT+0400
diff --git a/ext/date/tests/date_modify_basic1.phpt b/ext/date/tests/date_modify_basic1.phpt
new file mode 100644
index 0000000..038b94c
--- /dev/null
+++ b/ext/date/tests/date_modify_basic1.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test date_modify() function : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTime date_modify ( DateTime $object , string $modify )
+ * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
+ * Source code: ext/date/php_date.c
+ * Alias to functions: public DateTime DateTime::modify()
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_modify() : basic functionality ***\n";
+
+// Create a date object to modify
+$datetime = date_create("2009-01-31 14:28:41");
+
+date_modify($datetime, "+1 day");
+echo "After modification 1: " . date_format($datetime, "D, d M Y") . "\n";
+
+date_modify($datetime, "+1 week 2 days 4 hours 2 seconds");
+echo "After modification 2: " . date_format($datetime, "D, d M Y H:i:s") . "\n";
+
+date_modify($datetime, "next Thursday");
+echo "After modification 3: " . date_format($datetime, "D, d M Y") . "\n";
+
+date_modify($datetime, "last Sunday");
+echo "After modification 4: " . date_format($datetime, "D, d M Y") . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_modify() : basic functionality ***
+After modification 1: Sun, 01 Feb 2009
+After modification 2: Tue, 10 Feb 2009 18:28:43
+After modification 3: Thu, 12 Feb 2009
+After modification 4: Sun, 08 Feb 2009
+===DONE===
diff --git a/ext/date/tests/date_modify_error.phpt b/ext/date/tests/date_modify_error.phpt
new file mode 100644
index 0000000..ac727f1
--- /dev/null
+++ b/ext/date/tests/date_modify_error.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test date_modify() function : error conditions
+--FILE--
+<?php
+/* Prototype : DateTime date_modify ( DateTime $object , string $modify )
+ * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
+ * Source code: ext/date/php_date.c
+ * Alias to functions: public DateTime DateTime::modify()
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_modify() : error conditions ***\n";
+
+echo "\n-- Testing date_modify() function with zero arguments --\n";
+var_dump( date_modify() );
+
+// Create a date object
+$datetime = date_create("2009-01-30 19:34:10");
+
+echo "\n-- Testing date_modify() function with less than expected no. of arguments --\n";
+var_dump( date_modify($datetime) );
+
+echo "\n-- Testing date_modify() function with more than expected no. of arguments --\n";
+$modify = "+1 day";
+$extra_arg = 99;
+var_dump( date_modify($datetime, $modify, $extra_arg) );
+
+echo "\n-- Testing date_modify() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( date_modify($invalid_obj, $modify) );
+$invalid_obj = 10;
+var_dump( date_modify($invalid_obj, $modify) );
+$invalid_obj = null;
+var_dump( date_modify($invalid_obj, $modify) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_modify() : error conditions ***
+
+-- Testing date_modify() function with zero arguments --
+
+Warning: date_modify() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_modify() function with less than expected no. of arguments --
+
+Warning: date_modify() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing date_modify() function with more than expected no. of arguments --
+
+Warning: date_modify() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+
+-- Testing date_modify() function with an invalid values for $object argument --
+
+Warning: date_modify() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+Warning: date_modify() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_modify_variation1.phpt b/ext/date/tests/date_modify_variation1.phpt
new file mode 100644
index 0000000..00c9939
--- /dev/null
+++ b/ext/date/tests/date_modify_variation1.phpt
@@ -0,0 +1,252 @@
+--TEST--
+Test date_modify() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : DateTime date_modify ( DateTime $object , string $modify )
+ * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
+ * Source code: ext/date/php_date.c
+ * Alias to functions: public DateTime DateTime::modify()
+ */
+
+echo "*** Testing date_modify() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$format = "D, d M Y";
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( date_modify($object, $format) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_modify() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: date_modify() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_modify() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_modify() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_modify() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_modify() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_modify() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_modify() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_modify() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_modify() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_modify() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_modify() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_modify() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_modify() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_modify() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_modify() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_modify() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_modify() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_modify() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_modify_variation2.phpt b/ext/date/tests/date_modify_variation2.phpt
new file mode 100644
index 0000000..fe6afb1
--- /dev/null
+++ b/ext/date/tests/date_modify_variation2.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test date_modify() function : usage variation - Passing unexpected values to second argument $format.
+--FILE--
+<?php
+/* Prototype : DateTime date_modify ( DateTime $object , string $modify )
+ * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
+ * Source code: ext/date/php_date.c
+ * Alias to functions: public DateTime DateTime::modify()
+ */
+
+echo "*** Testing date_modify() : usage variation - unexpected values to second argument \$format***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-01-31 14:28:41");
+
+foreach($inputs as $variation =>$format) {
+ echo "\n-- $variation --\n";
+ var_dump( date_modify($object, $format) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_modify() : usage variation - unexpected values to second argument $format***
+
+-- int 0 --
+
+Warning: date_modify(): Failed to parse time string (0) at position 0 (0): Unexpected character in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- int 1 --
+
+Warning: date_modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- int 12345 --
+
+Warning: date_modify(): Failed to parse time string (12345) at position 4 (5): Unexpected character in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- int -12345 --
+
+Warning: date_modify(): Failed to parse time string (-12345) at position 5 (5): Unexpected character in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:05:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+
+Warning: date_modify(): Failed to parse time string (-10.5) at position 4 (5): Unexpected character in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 00:05:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_modify() expects parameter 2 to be string, array given in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- int indexed array --
+
+Warning: date_modify() expects parameter 2 to be string, array given in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- associative array --
+
+Warning: date_modify() expects parameter 2 to be string, array given in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- nested arrays --
+
+Warning: date_modify() expects parameter 2 to be string, array given in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- lowercase null --
+
+Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- lowercase true --
+
+Warning: date_modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- lowercase false --
+
+Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- string DQ --
+
+Warning: date_modify(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- string SQ --
+
+Warning: date_modify(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- mixed case string --
+
+Warning: date_modify(): Failed to parse time string (sTrInG) at position 0 (s): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- heredoc --
+
+Warning: date_modify(): Failed to parse time string (hello world) at position 0 (h): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_modify(): Failed to parse time string (Class A object) at position 0 (C): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_modify() expects parameter 2 to be string, object given in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- undefined var --
+
+Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- unset var --
+
+Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99
+bool(false)
+
+-- resource --
+
+Warning: date_modify() expects parameter 2 to be string, resource given in %sdate_modify_variation2.php on line 99
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_offset_get_basic1.phpt b/ext/date/tests/date_offset_get_basic1.phpt
new file mode 100644
index 0000000..42f3893
--- /dev/null
+++ b/ext/date/tests/date_offset_get_basic1.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test date_offset_get() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int date_offset_get ( DateTime $object )
+ * Description: Returns the daylight saving time offset
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::getOffset
+ */
+
+//Set the default time zone
+date_default_timezone_set('Europe/London');
+
+echo "*** Testing date_offset_get() : basic functionality ***\n";
+
+$winter = date_create('2008-12-25 14:25:41');
+$summer = date_create('2008-07-02 14:25:41');
+
+echo "Winter offset: " . date_offset_get($winter) / 3600 . " hours\n";
+echo "Summer offset: " . date_offset_get($summer) / 3600 . " hours\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_offset_get() : basic functionality ***
+Winter offset: 0 hours
+Summer offset: 1 hours
+===DONE===
diff --git a/ext/date/tests/date_offset_get_error.phpt b/ext/date/tests/date_offset_get_error.phpt
new file mode 100644
index 0000000..bd4e429
--- /dev/null
+++ b/ext/date/tests/date_offset_get_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test date_offset_get() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : int date_offset_get ( DateTime $object )
+ * Description: Returns the daylight saving time offset
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::getOffset
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_offset_get() : error conditions ***\n";
+
+echo "\n-- Testing date_offset_get() function with zero arguments --\n";
+var_dump( date_offset_get() );
+
+echo "\n-- Testing date_offset_get() function with more than expected no. of arguments --\n";
+$datetime = date_create("2009-01-30 19:34:10");
+$extra_arg = 30;
+var_dump( date_offset_get($datetime, $extra_arg) );
+
+echo "\n-- Testing date_offset_get() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( date_offset_get($invalid_obj) );
+$invalid_obj = 10;
+var_dump( date_offset_get($invalid_obj) );
+$invalid_obj = null;
+var_dump( date_offset_get($invalid_obj) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_offset_get() : error conditions ***
+
+-- Testing date_offset_get() function with zero arguments --
+
+Warning: date_offset_get() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_offset_get() function with more than expected no. of arguments --
+
+Warning: date_offset_get() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing date_offset_get() function with an invalid values for $object argument --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_offset_get_variation1.phpt b/ext/date/tests/date_offset_get_variation1.phpt
new file mode 100644
index 0000000..9df6e2d
--- /dev/null
+++ b/ext/date/tests/date_offset_get_variation1.phpt
@@ -0,0 +1,250 @@
+--TEST--
+Test date_offset_get() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : int date_offset_get ( DateTime $object )
+ * Description: Returns the daylight saving time offset
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::getOffset
+ */
+
+echo "*** Testing date_offset_get() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( date_offset_get($object) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_offset_get() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_offset_get() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_parse_001.phpt b/ext/date/tests/date_parse_001.phpt
new file mode 100644
index 0000000..fd1394c
--- /dev/null
+++ b/ext/date/tests/date_parse_001.phpt
@@ -0,0 +1,304 @@
+--TEST--
+Test basic date_parse()
+--FILE--
+<?php
+ date_default_timezone_set('UTC');
+ var_dump(date_parse("2006-12-12 10:00:00.5"));
+ var_dump(date_parse("2006-12-12"));
+ var_dump(date_parse("2006-12--12"));
+ var_dump(date_parse("2006-02-30"));
+ var_dump(date_parse("2006-03-04"));
+ var_dump(date_parse("2006-03"));
+ var_dump(date_parse("03-03"));
+ var_dump(date_parse("0-0"));
+ var_dump(date_parse(""));
+ var_dump(date_parse(array()));
+ echo "Done\n";
+?>
+--EXPECTF--
+array(12) {
+ ["year"]=>
+ int(2006)
+ ["month"]=>
+ int(12)
+ ["day"]=>
+ int(12)
+ ["hour"]=>
+ int(10)
+ ["minute"]=>
+ int(0)
+ ["second"]=>
+ int(0)
+ ["fraction"]=>
+ float(0.5)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+array(12) {
+ ["year"]=>
+ int(2006)
+ ["month"]=>
+ int(12)
+ ["day"]=>
+ int(12)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+array(15) {
+ ["year"]=>
+ int(2006)
+ ["month"]=>
+ int(12)
+ ["day"]=>
+ int(1)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(1)
+ ["errors"]=>
+ array(1) {
+ [7]=>
+ string(20) "Unexpected character"
+ }
+ ["is_localtime"]=>
+ bool(true)
+ ["zone_type"]=>
+ int(1)
+ ["zone"]=>
+ int(720)
+ ["is_dst"]=>
+ bool(false)
+}
+array(12) {
+ ["year"]=>
+ int(2006)
+ ["month"]=>
+ int(2)
+ ["day"]=>
+ int(30)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [11]=>
+ string(27) "The parsed date was invalid"
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+array(12) {
+ ["year"]=>
+ int(2006)
+ ["month"]=>
+ int(3)
+ ["day"]=>
+ int(4)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+array(12) {
+ ["year"]=>
+ int(2006)
+ ["month"]=>
+ int(3)
+ ["day"]=>
+ int(1)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+array(15) {
+ ["year"]=>
+ bool(false)
+ ["month"]=>
+ bool(false)
+ ["day"]=>
+ bool(false)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(2)
+ ["errors"]=>
+ array(2) {
+ [0]=>
+ string(20) "Unexpected character"
+ [1]=>
+ string(20) "Unexpected character"
+ }
+ ["is_localtime"]=>
+ bool(true)
+ ["zone_type"]=>
+ int(1)
+ ["zone"]=>
+ int(180)
+ ["is_dst"]=>
+ bool(false)
+}
+array(15) {
+ ["year"]=>
+ bool(false)
+ ["month"]=>
+ bool(false)
+ ["day"]=>
+ bool(false)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(1)
+ ["errors"]=>
+ array(1) {
+ [0]=>
+ string(20) "Unexpected character"
+ }
+ ["is_localtime"]=>
+ bool(true)
+ ["zone_type"]=>
+ int(1)
+ ["zone"]=>
+ int(0)
+ ["is_dst"]=>
+ bool(false)
+}
+array(12) {
+ ["year"]=>
+ bool(false)
+ ["month"]=>
+ bool(false)
+ ["day"]=>
+ bool(false)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(1)
+ ["errors"]=>
+ array(1) {
+ [0]=>
+ string(12) "Empty string"
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+
+Warning: date_parse() expects parameter 1 to be string, array given in %sdate_parse_001.php on line %d
+bool(false)
+Done
diff --git a/ext/date/tests/date_parse_basic1.phpt b/ext/date/tests/date_parse_basic1.phpt
new file mode 100644
index 0000000..04710d1
--- /dev/null
+++ b/ext/date/tests/date_parse_basic1.phpt
@@ -0,0 +1,107 @@
+--TEST--
+Test date_parse() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array date_parse ( string $date )
+ * Description: Returns associative array with detailed info about given date.
+ * Source code: ext/date/php_date.c
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_parse() : basic functionality ***\n";
+
+var_dump( date_parse("2009-02-27 10:00:00.5") );
+var_dump( date_parse("10:00:00.5") );
+var_dump( date_parse("2009-02-27") );
+
+?>
+===DONE===
+--EXPECT--
+*** Testing date_parse() : basic functionality ***
+array(12) {
+ ["year"]=>
+ int(2009)
+ ["month"]=>
+ int(2)
+ ["day"]=>
+ int(27)
+ ["hour"]=>
+ int(10)
+ ["minute"]=>
+ int(0)
+ ["second"]=>
+ int(0)
+ ["fraction"]=>
+ float(0.5)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+array(12) {
+ ["year"]=>
+ bool(false)
+ ["month"]=>
+ bool(false)
+ ["day"]=>
+ bool(false)
+ ["hour"]=>
+ int(10)
+ ["minute"]=>
+ int(0)
+ ["second"]=>
+ int(0)
+ ["fraction"]=>
+ float(0.5)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+array(12) {
+ ["year"]=>
+ int(2009)
+ ["month"]=>
+ int(2)
+ ["day"]=>
+ int(27)
+ ["hour"]=>
+ bool(false)
+ ["minute"]=>
+ bool(false)
+ ["second"]=>
+ bool(false)
+ ["fraction"]=>
+ bool(false)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+===DONE===
diff --git a/ext/date/tests/date_parse_error.phpt b/ext/date/tests/date_parse_error.phpt
new file mode 100644
index 0000000..389f519
--- /dev/null
+++ b/ext/date/tests/date_parse_error.phpt
@@ -0,0 +1,89 @@
+--TEST--
+Test date_parse() function : error conditions
+--FILE--
+<?php
+/* Prototype : array date_parse ( string $date )
+ * Description: Returns associative array with detailed info about given date.
+ * Source code: ext/date/php_date.c
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_parse() : error conditions ***\n";
+
+echo "\n-- Testing date_parse() function with zero arguments --\n";
+var_dump( date_parse() );
+
+echo "\n-- Testing date_parse() function with more than expected no. of arguments --\n";
+$date = "2009-02-27 10:00:00.5";
+$extra_arg = 10;
+var_dump( date_parse($date, $extra_arg) );
+
+echo "\n-- Testing date_parse() function with unexpected characters in \$date argument --\n";
+$invalid_date = "2OO9-02--27 10:00?00.5";
+var_dump( date_parse($invalid_date) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_parse() : error conditions ***
+
+-- Testing date_parse() function with zero arguments --
+
+Warning: date_parse() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_parse() function with more than expected no. of arguments --
+
+Warning: date_parse() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing date_parse() function with unexpected characters in $date argument --
+array(13) {
+ ["year"]=>
+ bool(false)
+ ["month"]=>
+ bool(false)
+ ["day"]=>
+ bool(false)
+ ["hour"]=>
+ int(10)
+ ["minute"]=>
+ int(0)
+ ["second"]=>
+ int(0)
+ ["fraction"]=>
+ float(0)
+ ["warning_count"]=>
+ int(1)
+ ["warnings"]=>
+ array(1) {
+ [4]=>
+ string(29) "Double timezone specification"
+ }
+ ["error_count"]=>
+ int(7)
+ ["errors"]=>
+ array(7) {
+ [0]=>
+ string(20) "Unexpected character"
+ [1]=>
+ string(47) "The timezone could not be found in the database"
+ [3]=>
+ string(20) "Unexpected character"
+ [7]=>
+ string(20) "Unexpected character"
+ [8]=>
+ string(29) "Double timezone specification"
+ [17]=>
+ string(20) "Unexpected character"
+ [18]=>
+ string(25) "Double time specification"
+ }
+ ["is_localtime"]=>
+ bool(true)
+ ["zone_type"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/date_parse_from_format_basic.phpt b/ext/date/tests/date_parse_from_format_basic.phpt
new file mode 100644
index 0000000..644949a
--- /dev/null
+++ b/ext/date/tests/date_parse_from_format_basic.phpt
@@ -0,0 +1,14 @@
+--TEST--
+date_parse_from_format() return false with wrong params
+--CREDITS--
+"Anna Filina" <afilina@phpquebec.org>
+#PHPTestFest2009 2009-05-02
+--INI--
+date.timezone=UTC
+display_errors=false
+--FILE--
+<?php
+var_dump(date_parse_from_format()); // invalid parameters
+?>
+--EXPECT--
+bool(false) \ No newline at end of file
diff --git a/ext/date/tests/date_parse_variation1.phpt b/ext/date/tests/date_parse_variation1.phpt
new file mode 100644
index 0000000..300bd5e
--- /dev/null
+++ b/ext/date/tests/date_parse_variation1.phpt
@@ -0,0 +1,274 @@
+--TEST--
+Test date_parse() function : usage variation - Passing unexpected values to first argument $date.
+--FILE--
+<?php
+/* Prototype : array date_parse ( string $date )
+ * Description: Returns associative array with detailed info about given date.
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date_parse() : usage variation - unexpected values to first argument \$date***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+foreach($inputs as $variation =>$date) {
+ echo "\n-- $variation --\n";
+ $result = date_parse($date);
+ if (is_array($result)) {
+ var_dump($result["errors"]);
+ } else {
+ var_dump($result);
+ }
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_parse() : usage variation - unexpected values to first argument $date***
+
+-- int 0 --
+array(1) {
+ [0]=>
+ string(20) "Unexpected character"
+}
+
+-- int 1 --
+array(1) {
+ [0]=>
+ string(20) "Unexpected character"
+}
+
+-- int 12345 --
+array(1) {
+ [4]=>
+ string(20) "Unexpected character"
+}
+
+-- int -12345 --
+array(1) {
+ [5]=>
+ string(20) "Unexpected character"
+}
+
+-- float 10.5 --
+array(0) {
+}
+
+-- float -10.5 --
+array(1) {
+ [4]=>
+ string(20) "Unexpected character"
+}
+
+-- float .5 --
+array(0) {
+}
+
+-- empty array --
+
+Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+array(1) {
+ [0]=>
+ string(12) "Empty string"
+}
+
+-- lowercase null --
+array(1) {
+ [0]=>
+ string(12) "Empty string"
+}
+
+-- lowercase true --
+array(1) {
+ [0]=>
+ string(20) "Unexpected character"
+}
+
+-- lowercase false --
+array(1) {
+ [0]=>
+ string(12) "Empty string"
+}
+
+-- uppercase TRUE --
+array(1) {
+ [0]=>
+ string(20) "Unexpected character"
+}
+
+-- uppercase FALSE --
+array(1) {
+ [0]=>
+ string(12) "Empty string"
+}
+
+-- empty string DQ --
+array(1) {
+ [0]=>
+ string(12) "Empty string"
+}
+
+-- empty string SQ --
+array(1) {
+ [0]=>
+ string(12) "Empty string"
+}
+
+-- string DQ --
+array(1) {
+ [0]=>
+ string(47) "The timezone could not be found in the database"
+}
+
+-- string SQ --
+array(1) {
+ [0]=>
+ string(47) "The timezone could not be found in the database"
+}
+
+-- mixed case string --
+array(1) {
+ [0]=>
+ string(47) "The timezone could not be found in the database"
+}
+
+-- heredoc --
+array(1) {
+ [0]=>
+ string(47) "The timezone could not be found in the database"
+}
+
+-- instance of classWithToString --
+array(2) {
+ [0]=>
+ string(47) "The timezone could not be found in the database"
+ [8]=>
+ string(29) "Double timezone specification"
+}
+
+-- instance of classWithoutToString --
+
+Warning: date_parse() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+array(1) {
+ [0]=>
+ string(12) "Empty string"
+}
+
+-- unset var --
+array(1) {
+ [0]=>
+ string(12) "Empty string"
+}
+
+-- resource --
+
+Warning: date_parse() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_period.phpt b/ext/date/tests/date_period.phpt
new file mode 100644
index 0000000..6ec4435
--- /dev/null
+++ b/ext/date/tests/date_period.phpt
@@ -0,0 +1,63 @@
+--TEST--
+DatePeriod
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+$db = new DateTime( '2008-01-01' );
+$de = new DateTime( '2008-12-31' );
+$di = DateInterval::createFromDateString( 'first day of next month' );
+
+foreach ( new DatePeriod( $db, $di, $de ) as $dt )
+{
+ echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" );
+}
+?>
+
+<?php
+$db = new DateTime( '2007-12-31' );
+$de = new DateTime( '2009-12-31 23:59:59' );
+$di = DateInterval::createFromDateString( 'last thursday of next month' );
+
+foreach ( new DatePeriod( $db, $di, $de, DatePeriod::EXCLUDE_START_DATE ) as $dt )
+{
+ echo $dt->format( "l Y-m-d H:i:s\n" );
+}
+?>
+--EXPECT--
+Tuesday 2008-01-15
+Tuesday 2008-02-19
+Tuesday 2008-03-18
+Tuesday 2008-04-15
+Tuesday 2008-05-20
+Tuesday 2008-06-17
+Tuesday 2008-07-15
+Tuesday 2008-08-19
+Tuesday 2008-09-16
+Tuesday 2008-10-21
+Tuesday 2008-11-18
+Tuesday 2008-12-16
+
+Thursday 2008-01-31 00:00:00
+Thursday 2008-02-28 00:00:00
+Thursday 2008-03-27 00:00:00
+Thursday 2008-04-24 00:00:00
+Thursday 2008-05-29 00:00:00
+Thursday 2008-06-26 00:00:00
+Thursday 2008-07-31 00:00:00
+Thursday 2008-08-28 00:00:00
+Thursday 2008-09-25 00:00:00
+Thursday 2008-10-30 00:00:00
+Thursday 2008-11-27 00:00:00
+Thursday 2008-12-25 00:00:00
+Thursday 2009-01-29 00:00:00
+Thursday 2009-02-26 00:00:00
+Thursday 2009-03-26 00:00:00
+Thursday 2009-04-30 00:00:00
+Thursday 2009-05-28 00:00:00
+Thursday 2009-06-25 00:00:00
+Thursday 2009-07-30 00:00:00
+Thursday 2009-08-27 00:00:00
+Thursday 2009-09-24 00:00:00
+Thursday 2009-10-29 00:00:00
+Thursday 2009-11-26 00:00:00
+Thursday 2009-12-31 00:00:00
diff --git a/ext/date/tests/date_sub_basic.phpt b/ext/date/tests/date_sub_basic.phpt
new file mode 100644
index 0000000..0e12704
--- /dev/null
+++ b/ext/date/tests/date_sub_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test date_sub() function : basic functionality
+--CREDITS--
+Felix De Vliegher <felix.devliegher@gmail.com>
+--SKIPIF--
+<?php if (!function_exists('date_sub')) echo "skip: date_sub() function not found!"; ?>
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+/* Prototype : void date_sub(DateTime object, DateInterval interval)
+ * Description: Subtracts an interval from the current date in object.
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sub() : basic functionality ***\n";
+
+// Initialise all required variables
+$startDate = '2008-01-01 12:25';
+$format = 'Y-m-d H:i:s';
+$intervals = array(
+ 'P3Y6M4DT12H30M5S',
+ 'P0D',
+ 'P2DT1M',
+ 'P1Y2MT23H43M150S'
+);
+
+$d = new DateTime($startDate);
+var_dump( $d->format($format) );
+
+foreach($intervals as $interval) {
+ date_sub($d, new DateInterval($interval) );
+ var_dump( $d->format($format) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sub() : basic functionality ***
+string(19) "2008-01-01 12:25:00"
+string(19) "2004-06-26 23:54:55"
+string(19) "2004-06-26 23:54:55"
+string(19) "2004-06-24 23:53:55"
+string(19) "2003-04-24 00:08:25"
+===DONE===
diff --git a/ext/date/tests/date_sun_info_001.phpt b/ext/date/tests/date_sun_info_001.phpt
new file mode 100644
index 0000000..e4f893b
--- /dev/null
+++ b/ext/date/tests/date_sun_info_001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test basic date_sun_info()
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+$sun_info = date_sun_info(strtotime("2006-12-12"), 31.7667, 35.2333);
+var_dump($sun_info);
+echo "Done\n";
+?>
+--EXPECTF--
+array(9) {
+ ["sunrise"]=>
+ int(1165897782)
+ ["sunset"]=>
+ int(1165934168)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165896176)
+ ["civil_twilight_end"]=>
+ int(1165935773)
+ ["nautical_twilight_begin"]=>
+ int(1165894353)
+ ["nautical_twilight_end"]=>
+ int(1165937597)
+ ["astronomical_twilight_begin"]=>
+ int(1165892570)
+ ["astronomical_twilight_end"]=>
+ int(1165939380)
+}
+Done
diff --git a/ext/date/tests/date_sun_info_002.phpt b/ext/date/tests/date_sun_info_002.phpt
new file mode 100644
index 0000000..6233392
--- /dev/null
+++ b/ext/date/tests/date_sun_info_002.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test basic date_sun_info()
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+$sun_info = date_sun_info(strtotime("2007-04-13 08:31:15 UTC"), 59.21, 9.61);
+foreach ($sun_info as $key => $elem )
+{
+ echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n";
+}
+echo "Done\n";
+?>
+--EXPECTF--
+2007-04-13 06:12:19 CEST sunrise
+2007-04-13 20:31:50 CEST sunset
+2007-04-13 13:22:05 CEST transit
+2007-04-13 05:28:03 CEST civil_twilight_begin
+2007-04-13 21:16:06 CEST civil_twilight_end
+2007-04-13 04:30:08 CEST nautical_twilight_begin
+2007-04-13 22:14:01 CEST nautical_twilight_end
+2007-04-13 03:14:36 CEST astronomical_twilight_begin
+2007-04-13 23:29:33 CEST astronomical_twilight_end
+Done
diff --git a/ext/date/tests/date_sun_info_error.phpt b/ext/date/tests/date_sun_info_error.phpt
new file mode 100644
index 0000000..8d57247
--- /dev/null
+++ b/ext/date/tests/date_sun_info_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test date_sun_info() function : error variations
+--FILE--
+<?php
+/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude )
+ * Description: Returns an array with information about sunset/sunrise and twilight begin/end.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+echo "*** Testing date_sun_info() : usage variations ***\n";
+
+$time = "2006-12-12";
+$latitude=31.7667;
+$longitude=35.2333;
+
+echo "\n-- Testing date_sun_info() function with less than expected no. of arguments --\n";
+var_dump( date_sun_info() );
+var_dump( date_sun_info($time) );
+var_dump( date_sun_info($time, $latitude) );
+
+
+echo "\n-- Testing date_sun_info() function with more than expected no. of arguments --\n";
+$extra_arg = 99;
+var_dump( date_create($time, $latitude, $longitude, $extra_arg) );
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_sun_info() : usage variations ***
+
+-- Testing date_sun_info() function with less than expected no. of arguments --
+
+Warning: date_sun_info() expects exactly 3 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: date_sun_info() expects exactly 3 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: date_sun_info() expects exactly 3 parameters, 2 given in %s on line %d
+bool(false)
+
+-- Testing date_sun_info() function with more than expected no. of arguments --
+
+Warning: date_create() expects at most 2 parameters, 4 given in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/date_sun_info_variation1.phpt b/ext/date/tests/date_sun_info_variation1.phpt
new file mode 100644
index 0000000..382ba28
--- /dev/null
+++ b/ext/date/tests/date_sun_info_variation1.phpt
@@ -0,0 +1,492 @@
+--TEST--
+Test date_sun_info() function : error variations - Pass unexpected values for time argument
+--FILE--
+<?php
+/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude )
+ * Description: Returns an array with information about sunset/sunrise and twilight begin/end.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_sun_info() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e5,
+ 12.3456789000E-5,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of date_sun_info()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(date_sun_info($input, 31.7667, 35.2333));
+ $iterator++;
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_sun_info() : usage variations ***
+
+-- Iteration 1 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 2 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 3 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 4 --
+array(9) {
+ ["sunrise"]=>
+ int(-69665)
+ ["sunset"]=>
+ int(-33260)
+ ["transit"]=>
+ int(-51462)
+ ["civil_twilight_begin"]=>
+ int(-71269)
+ ["civil_twilight_end"]=>
+ int(-31655)
+ ["nautical_twilight_begin"]=>
+ int(-73092)
+ ["nautical_twilight_end"]=>
+ int(-29832)
+ ["astronomical_twilight_begin"]=>
+ int(-74874)
+ ["astronomical_twilight_end"]=>
+ int(-28050)
+}
+
+-- Iteration 5 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 6 --
+array(9) {
+ ["sunrise"]=>
+ int(-69665)
+ ["sunset"]=>
+ int(-33260)
+ ["transit"]=>
+ int(-51462)
+ ["civil_twilight_begin"]=>
+ int(-71269)
+ ["civil_twilight_end"]=>
+ int(-31655)
+ ["nautical_twilight_begin"]=>
+ int(-73092)
+ ["nautical_twilight_end"]=>
+ int(-29832)
+ ["astronomical_twilight_begin"]=>
+ int(-74874)
+ ["astronomical_twilight_end"]=>
+ int(-28050)
+}
+
+-- Iteration 7 --
+array(9) {
+ ["sunrise"]=>
+ int(1226363)
+ ["sunset"]=>
+ int(1263468)
+ ["transit"]=>
+ int(1244916)
+ ["civil_twilight_begin"]=>
+ int(1224788)
+ ["civil_twilight_end"]=>
+ int(1265044)
+ ["nautical_twilight_begin"]=>
+ int(1222993)
+ ["nautical_twilight_end"]=>
+ int(1266839)
+ ["astronomical_twilight_begin"]=>
+ int(1221233)
+ ["astronomical_twilight_end"]=>
+ int(1268599)
+}
+
+-- Iteration 8 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 9 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 10 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 11 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 12 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 13 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 14 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 15 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 16 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: date_sun_info() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 23 --
+array(9) {
+ ["sunrise"]=>
+ int(16748)
+ ["sunset"]=>
+ int(53182)
+ ["transit"]=>
+ int(34965)
+ ["civil_twilight_begin"]=>
+ int(15145)
+ ["civil_twilight_end"]=>
+ int(54786)
+ ["nautical_twilight_begin"]=>
+ int(13324)
+ ["nautical_twilight_end"]=>
+ int(56607)
+ ["astronomical_twilight_begin"]=>
+ int(11542)
+ ["astronomical_twilight_end"]=>
+ int(58389)
+}
+
+-- Iteration 24 --
+
+Warning: date_sun_info() expects parameter 1 to be long, resource given in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/date_sun_info_variation2.phpt b/ext/date/tests/date_sun_info_variation2.phpt
new file mode 100644
index 0000000..fb5ed31
--- /dev/null
+++ b/ext/date/tests/date_sun_info_variation2.phpt
@@ -0,0 +1,492 @@
+--TEST--
+Test date_sun_info() function : error variations - Pass unexpected values for latitude argument
+--FILE--
+<?php
+/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude )
+ * Description: Returns an array with information about sunset/sunrise and twilight begin/end.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_sun_info() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of date_sun_info()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(date_sun_info(strtotime("2006-12-12"), $input, 35.2333));
+ $iterator++;
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_sun_info() : usage variations ***
+
+-- Iteration 1 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 2 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894254)
+ ["sunset"]=>
+ int(1165937695)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892911)
+ ["civil_twilight_end"]=>
+ int(1165939038)
+ ["nautical_twilight_begin"]=>
+ int(1165891344)
+ ["nautical_twilight_end"]=>
+ int(1165940606)
+ ["astronomical_twilight_begin"]=>
+ int(1165889771)
+ ["astronomical_twilight_end"]=>
+ int(1165942179)
+}
+
+-- Iteration 3 --
+array(9) {
+ ["sunrise"]=>
+ bool(true)
+ ["sunset"]=>
+ bool(true)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ bool(true)
+ ["civil_twilight_end"]=>
+ bool(true)
+ ["nautical_twilight_begin"]=>
+ int(1165883331)
+ ["nautical_twilight_end"]=>
+ int(1165948619)
+ ["astronomical_twilight_begin"]=>
+ int(1165890260)
+ ["astronomical_twilight_end"]=>
+ int(1165941690)
+}
+
+-- Iteration 4 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894085)
+ ["sunset"]=>
+ int(1165937865)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165895431)
+ ["civil_twilight_end"]=>
+ int(1165936519)
+ ["nautical_twilight_begin"]=>
+ int(1165896998)
+ ["nautical_twilight_end"]=>
+ int(1165934952)
+ ["astronomical_twilight_begin"]=>
+ int(1165898564)
+ ["astronomical_twilight_end"]=>
+ int(1165933386)
+}
+
+-- Iteration 5 --
+array(9) {
+ ["sunrise"]=>
+ int(1165895237)
+ ["sunset"]=>
+ int(1165936713)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165893873)
+ ["civil_twilight_end"]=>
+ int(1165938077)
+ ["nautical_twilight_begin"]=>
+ int(1165892293)
+ ["nautical_twilight_end"]=>
+ int(1165939656)
+ ["astronomical_twilight_begin"]=>
+ int(1165890721)
+ ["astronomical_twilight_end"]=>
+ int(1165941229)
+}
+
+-- Iteration 6 --
+array(9) {
+ ["sunrise"]=>
+ int(1165893058)
+ ["sunset"]=>
+ int(1165938891)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165891680)
+ ["civil_twilight_end"]=>
+ int(1165940269)
+ ["nautical_twilight_begin"]=>
+ int(1165890055)
+ ["nautical_twilight_end"]=>
+ int(1165941895)
+ ["astronomical_twilight_begin"]=>
+ int(1165888402)
+ ["astronomical_twilight_end"]=>
+ int(1165943548)
+}
+
+-- Iteration 7 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 8 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 9 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894203)
+ ["sunset"]=>
+ int(1165937747)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892860)
+ ["civil_twilight_end"]=>
+ int(1165939090)
+ ["nautical_twilight_begin"]=>
+ int(1165891292)
+ ["nautical_twilight_end"]=>
+ int(1165940658)
+ ["astronomical_twilight_begin"]=>
+ int(1165889717)
+ ["astronomical_twilight_end"]=>
+ int(1165942233)
+}
+
+-- Iteration 10 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 11 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 12 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894254)
+ ["sunset"]=>
+ int(1165937695)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892911)
+ ["civil_twilight_end"]=>
+ int(1165939038)
+ ["nautical_twilight_begin"]=>
+ int(1165891344)
+ ["nautical_twilight_end"]=>
+ int(1165940606)
+ ["astronomical_twilight_begin"]=>
+ int(1165889771)
+ ["astronomical_twilight_end"]=>
+ int(1165942179)
+}
+
+-- Iteration 13 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 14 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894254)
+ ["sunset"]=>
+ int(1165937695)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892911)
+ ["civil_twilight_end"]=>
+ int(1165939038)
+ ["nautical_twilight_begin"]=>
+ int(1165891344)
+ ["nautical_twilight_end"]=>
+ int(1165940606)
+ ["astronomical_twilight_begin"]=>
+ int(1165889771)
+ ["astronomical_twilight_end"]=>
+ int(1165942179)
+}
+
+-- Iteration 15 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 16 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: date_sun_info() expects parameter 2 to be double, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: date_sun_info() expects parameter 2 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 23 --
+array(9) {
+ ["sunrise"]=>
+ int(1165894152)
+ ["sunset"]=>
+ int(1165937798)
+ ["transit"]=>
+ int(1165915975)
+ ["civil_twilight_begin"]=>
+ int(1165892809)
+ ["civil_twilight_end"]=>
+ int(1165939141)
+ ["nautical_twilight_begin"]=>
+ int(1165891239)
+ ["nautical_twilight_end"]=>
+ int(1165940710)
+ ["astronomical_twilight_begin"]=>
+ int(1165889663)
+ ["astronomical_twilight_end"]=>
+ int(1165942287)
+}
+
+-- Iteration 24 --
+
+Warning: date_sun_info() expects parameter 2 to be double, resource given in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/date/tests/date_sun_info_variation3.phpt b/ext/date/tests/date_sun_info_variation3.phpt
new file mode 100644
index 0000000..673d1c6
--- /dev/null
+++ b/ext/date/tests/date_sun_info_variation3.phpt
@@ -0,0 +1,493 @@
+--TEST--
+Test date_sun_info() function : usage variations - Pass unexpected values for longitude argument
+--FILE--
+<?php
+/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude )
+ * Description: Returns an array with information about sunset/sunrise and twilight begin/end.
+ * Source code: ext/standard/data/php_date.c
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_sun_info() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of date_sun_info()
+$iterator = 1;
+
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(date_sun_info(strtotime("2006-12-12"), 31.7667, $input));
+ $iterator++;
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing date_sun_info() : usage variations ***
+
+-- Iteration 1 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 2 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906002)
+ ["sunset"]=>
+ int(1165942385)
+ ["transit"]=>
+ int(1165924194)
+ ["civil_twilight_begin"]=>
+ int(1165904396)
+ ["civil_twilight_end"]=>
+ int(1165943991)
+ ["nautical_twilight_begin"]=>
+ int(1165902573)
+ ["nautical_twilight_end"]=>
+ int(1165945814)
+ ["astronomical_twilight_begin"]=>
+ int(1165900789)
+ ["astronomical_twilight_end"]=>
+ int(1165947598)
+}
+
+-- Iteration 3 --
+array(9) {
+ ["sunrise"]=>
+ int(1165879335)
+ ["sunset"]=>
+ int(1165917916)
+ ["transit"]=>
+ int(1165898625)
+ ["civil_twilight_begin"]=>
+ int(1165877811)
+ ["civil_twilight_end"]=>
+ int(1165919440)
+ ["nautical_twilight_begin"]=>
+ int(1165876064)
+ ["nautical_twilight_end"]=>
+ int(1165921187)
+ ["astronomical_twilight_begin"]=>
+ int(1165874341)
+ ["astronomical_twilight_end"]=>
+ int(1165922910)
+}
+
+-- Iteration 4 --
+array(9) {
+ ["sunrise"]=>
+ int(1165864483)
+ ["sunset"]=>
+ int(1165900762)
+ ["transit"]=>
+ int(1165882623)
+ ["civil_twilight_begin"]=>
+ int(1165862873)
+ ["civil_twilight_end"]=>
+ int(1165902372)
+ ["nautical_twilight_begin"]=>
+ int(1165861045)
+ ["nautical_twilight_end"]=>
+ int(1165904200)
+ ["astronomical_twilight_begin"]=>
+ int(1165859259)
+ ["astronomical_twilight_end"]=>
+ int(1165905987)
+}
+
+-- Iteration 5 --
+array(9) {
+ ["sunrise"]=>
+ int(1165903721)
+ ["sunset"]=>
+ int(1165940105)
+ ["transit"]=>
+ int(1165921913)
+ ["civil_twilight_begin"]=>
+ int(1165902115)
+ ["civil_twilight_end"]=>
+ int(1165941711)
+ ["nautical_twilight_begin"]=>
+ int(1165900292)
+ ["nautical_twilight_end"]=>
+ int(1165943534)
+ ["astronomical_twilight_begin"]=>
+ int(1165898508)
+ ["astronomical_twilight_end"]=>
+ int(1165945317)
+}
+
+-- Iteration 6 --
+array(9) {
+ ["sunrise"]=>
+ int(1165908763)
+ ["sunset"]=>
+ int(1165945146)
+ ["transit"]=>
+ int(1165926954)
+ ["civil_twilight_begin"]=>
+ int(1165907157)
+ ["civil_twilight_end"]=>
+ int(1165946752)
+ ["nautical_twilight_begin"]=>
+ int(1165905334)
+ ["nautical_twilight_end"]=>
+ int(1165948575)
+ ["astronomical_twilight_begin"]=>
+ int(1165903551)
+ ["astronomical_twilight_end"]=>
+ int(1165950358)
+}
+
+-- Iteration 7 --
+array(9) {
+ ["sunrise"]=>
+ int(1165919856)
+ ["sunset"]=>
+ int(1165969985)
+ ["transit"]=>
+ int(1165944920)
+ ["civil_twilight_begin"]=>
+ int(1165918203)
+ ["civil_twilight_end"]=>
+ int(1165971638)
+ ["nautical_twilight_begin"]=>
+ int(1165916223)
+ ["nautical_twilight_end"]=>
+ int(1165973617)
+ ["astronomical_twilight_begin"]=>
+ int(1165914116)
+ ["astronomical_twilight_end"]=>
+ int(1165975725)
+}
+
+-- Iteration 8 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 9 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906122)
+ ["sunset"]=>
+ int(1165942505)
+ ["transit"]=>
+ int(1165924314)
+ ["civil_twilight_begin"]=>
+ int(1165904516)
+ ["civil_twilight_end"]=>
+ int(1165944111)
+ ["nautical_twilight_begin"]=>
+ int(1165902693)
+ ["nautical_twilight_end"]=>
+ int(1165945934)
+ ["astronomical_twilight_begin"]=>
+ int(1165900910)
+ ["astronomical_twilight_end"]=>
+ int(1165947718)
+}
+
+-- Iteration 10 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 11 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 12 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906002)
+ ["sunset"]=>
+ int(1165942385)
+ ["transit"]=>
+ int(1165924194)
+ ["civil_twilight_begin"]=>
+ int(1165904396)
+ ["civil_twilight_end"]=>
+ int(1165943991)
+ ["nautical_twilight_begin"]=>
+ int(1165902573)
+ ["nautical_twilight_end"]=>
+ int(1165945814)
+ ["astronomical_twilight_begin"]=>
+ int(1165900789)
+ ["astronomical_twilight_end"]=>
+ int(1165947598)
+}
+
+-- Iteration 13 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 14 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906002)
+ ["sunset"]=>
+ int(1165942385)
+ ["transit"]=>
+ int(1165924194)
+ ["civil_twilight_begin"]=>
+ int(1165904396)
+ ["civil_twilight_end"]=>
+ int(1165943991)
+ ["nautical_twilight_begin"]=>
+ int(1165902573)
+ ["nautical_twilight_end"]=>
+ int(1165945814)
+ ["astronomical_twilight_begin"]=>
+ int(1165900789)
+ ["astronomical_twilight_end"]=>
+ int(1165947598)
+}
+
+-- Iteration 15 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 16 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: date_sun_info() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: date_sun_info() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 23 --
+array(9) {
+ ["sunrise"]=>
+ int(1165906242)
+ ["sunset"]=>
+ int(1165942625)
+ ["transit"]=>
+ int(1165924434)
+ ["civil_twilight_begin"]=>
+ int(1165904636)
+ ["civil_twilight_end"]=>
+ int(1165944231)
+ ["nautical_twilight_begin"]=>
+ int(1165902813)
+ ["nautical_twilight_end"]=>
+ int(1165946054)
+ ["astronomical_twilight_begin"]=>
+ int(1165901030)
+ ["astronomical_twilight_end"]=>
+ int(1165947838)
+}
+
+-- Iteration 24 --
+
+Warning: date_sun_info() expects parameter 3 to be double, resource given in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/date/tests/date_sunrise_and_sunset_basic.phpt b/ext/date/tests/date_sunrise_and_sunset_basic.phpt
new file mode 100644
index 0000000..a96fa83
--- /dev/null
+++ b/ext/date/tests/date_sunrise_and_sunset_basic.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Basic test for date_sunrise and date_sunset based on example in PHP manual
+--FILE--
+<?php
+
+date_default_timezone_set('UTC');
+
+/* calculate the sunrise time for Lisbon, Portugal
+Latitude: 38.4 North
+Longitude: 9 West
+Zenith ~= 90
+offset: +1 GMT
+*/
+
+echo "Basic test for date_sunrise() and date_sunset()\n";
+
+// supress date() function strict msgs
+error_reporting(E_ALL & ~E_STRICT);
+
+echo date("D M d Y") . ', sunrise time : ' . date_sunrise(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
+echo date("D M d Y") . ', sunset time : ' . date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
+
+?>
+===Done===
+--EXPECTF--
+Basic test for date_sunrise() and date_sunset()
+%s %s %d %d, sunrise time : %d:%d
+%s %s %d %d, sunset time : %d:%d
+===Done===
diff --git a/ext/date/tests/date_sunrise_error.phpt b/ext/date/tests/date_sunrise_error.phpt
new file mode 100644
index 0000000..f57b7ed
--- /dev/null
+++ b/ext/date/tests/date_sunrise_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test date_sunrise() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date_sunrise() : error conditions ***\n";
+
+//Initialise the variables
+$time = time();
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+$extra_arg = 10;
+
+// Zero arguments
+echo "\n-- Testing date_sunrise() function with Zero arguments --\n";
+var_dump( date_sunrise() );
+
+//Test date_sunrise with one more than the expected number of arguments
+echo "\n-- Testing date_sunrise() function with more than expected no. of arguments --\n";
+var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : error conditions ***
+
+-- Testing date_sunrise() function with Zero arguments --
+
+Warning: date_sunrise() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_sunrise() function with more than expected no. of arguments --
+
+Warning: date_sunrise() expects at most 6 parameters, 7 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation1.phpt b/ext/date/tests/date_sunrise_variation1.phpt
new file mode 100644
index 0000000..35f964f
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation1.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to first argument time.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+//Initialise the variables
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+$format = SUNFUNCS_RET_STRING;
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for time
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($value, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($value, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($value, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--int 1--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--int 12345--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--int -12345--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--float 10.5--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--float -10.5--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--float .5--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--lowercase null--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--lowercase true--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--lowercase false--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--uppercase TRUE--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--uppercase FALSE--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+
+--unset var--
+string(5) "08:56"
+float(8.944%d)
+int(28599)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation2.phpt b/ext/date/tests/date_sunrise_variation2.phpt
new file mode 100644
index 0000000..b613b35
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation2.phpt
@@ -0,0 +1,211 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to second argument format.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, $value, $latitude, $longitude, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--float 10.5--
+
+Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float -10.5--
+
+Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float 12.3456789000e10--
+
+Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float -12.3456789000e10--
+
+Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float .5--
+int(1218174483)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218174483)
+
+--lowercase null--
+int(1218174483)
+
+--lowercase true--
+string(5) "06:48"
+
+--lowercase false--
+int(1218174483)
+
+--uppercase TRUE--
+string(5) "06:48"
+
+--uppercase FALSE--
+int(1218174483)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218174483)
+
+--unset var--
+int(1218174483)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation3.phpt b/ext/date/tests/date_sunrise_variation3.phpt
new file mode 100644
index 0000000..1911e30
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation3.phpt
@@ -0,0 +1,294 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to third argument latitude.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = -5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for latitude
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $value, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $value, $longitude, $zenith, $gmt_offset) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--int 1--
+string(5) "01:09"
+float(1.155%d)
+int(1218177558)
+
+--int 12345--
+bool(false)
+bool(false)
+bool(false)
+
+--int -12345--
+bool(false)
+bool(false)
+bool(false)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--lowercase null--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--lowercase true--
+string(5) "01:09"
+float(1.155%d)
+int(1218177558)
+
+--lowercase false--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--uppercase TRUE--
+string(5) "01:09"
+float(1.155%d)
+int(1218177558)
+
+--uppercase FALSE--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+
+--unset var--
+string(5) "01:10"
+float(1.174%d)
+int(1218177627)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation4.phpt b/ext/date/tests/date_sunrise_variation4.phpt
new file mode 100644
index 0000000..c48f538
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation4.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to fourth argument longitude.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+//Initialise the variables
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 38.4;
+$zenith = 90;
+$gmt_offset = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for longitude
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $value, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $value, $zenith, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $value, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--int 1--
+string(5) "05:08"
+float(5.133%d)
+int(1218172081)
+
+--int 12345--
+string(5) "21:45"
+float(21.759%d)
+int(1218145534)
+
+--int -12345--
+string(5) "12:41"
+float(12.698%d)
+int(1218199315)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--lowercase null--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--lowercase true--
+string(5) "05:08"
+float(5.133%d)
+int(1218172081)
+
+--lowercase false--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--uppercase TRUE--
+string(5) "05:08"
+float(5.133%d)
+int(1218172081)
+
+--uppercase FALSE--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+
+--unset var--
+string(5) "05:12"
+float(5.200%d)
+int(1218172321)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation5.phpt b/ext/date/tests/date_sunrise_variation5.phpt
new file mode 100644
index 0000000..4267478
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation5.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to fifth argument zenith
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 38.4;
+$longitude = -9;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for zenith
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $value, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $value, $gmt_offset) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $value, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+bool(false)
+bool(false)
+bool(false)
+
+--int 1--
+bool(false)
+bool(false)
+bool(false)
+
+--int 12345--
+string(5) "09:51"
+float(9.855%d)
+int(1218169278)
+
+--int -12345--
+string(5) "09:54"
+float(9.9097820911118)
+int(1218169475)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase null--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase true--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase false--
+bool(false)
+bool(false)
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+bool(false)
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+bool(false)
+bool(false)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+bool(false)
+bool(false)
+bool(false)
+
+--unset var--
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation6.phpt b/ext/date/tests/date_sunrise_variation6.phpt
new file mode 100644
index 0000000..a96b95f
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation6.phpt
@@ -0,0 +1,295 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing unexpected values to sixth argument gmt_offset.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for gmt_offset
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $value) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $value) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--int 0--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--int 1--
+string(5) "06:48"
+float(6.800%d)
+int(1218174483)
+
+--int 12345--
+string(5) "14:48"
+float(14.800%d)
+int(1218174483)
+
+--int -12345--
+string(5) "12:48"
+float(12.800%d)
+int(1218174483)
+
+--empty array--
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--lowercase null--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--lowercase true--
+string(5) "06:48"
+float(6.800%d)
+int(1218174483)
+
+--lowercase false--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--uppercase TRUE--
+string(5) "06:48"
+float(6.800%d)
+int(1218174483)
+
+--uppercase FALSE--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--empty string DQ--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunrise() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+
+--unset var--
+string(5) "05:48"
+float(5.800%d)
+int(1218174483)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation7.phpt b/ext/date/tests/date_sunrise_variation7.phpt
new file mode 100644
index 0000000..fa5f363
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation7.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test date_sunrise() function : usage variation - Checking sunrise for consecutive days in specific timezone
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+//Timezones with required data for date_sunrise
+$inputs = array (
+ //Timezone with Latitude, Longitude and GMT offset
+ "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
+ "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
+ "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
+ "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
+ "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0),
+ "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
+ "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
+ "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
+ "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
+);
+
+foreach($inputs as $timezone => $value) {
+ date_default_timezone_set($timezone);
+ $time = mktime(8, 8, 8, 8, 11, 2008);
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
+ $time = mktime(8, 8, 8, 8, 12, 2008);
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+string(5) "06:41"
+string(5) "06:41"
+string(5) "05:09"
+string(5) "05:11"
+string(5) "05:59"
+string(5) "06:00"
+string(5) "07:30"
+string(5) "07:29"
+string(5) "05:53"
+string(5) "05:53"
+string(5) "05:59"
+string(5) "06:01"
+string(5) "06:01"
+string(5) "06:02"
+string(5) "06:23"
+string(5) "06:22"
+string(5) "06:03"
+string(5) "06:02"
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation8.phpt b/ext/date/tests/date_sunrise_variation8.phpt
new file mode 100644
index 0000000..1d22be8
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation8.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test date_sunrise() function : usage variation - Checking with North and South poles when Sun is up and down all day
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// GMT is zero for the timezone
+date_default_timezone_set("Africa/Casablanca");
+$time_date = array (
+
+ //Date at which Sun is up all day at North Pole
+ "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
+ "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008),
+
+ //Date at which Sun is up all day at South Pole
+ "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
+ "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008),
+);
+
+//Iterate over different date and time
+foreach( $time_date as $date => $time ){
+ echo "\n--$date--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunrise() : usage variation ***
+
+--12 Aug 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--13 Aug 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--12 Nov 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--13 Nov 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunrise_variation9.phpt b/ext/date/tests/date_sunrise_variation9.phpt
new file mode 100644
index 0000000..49af06d
--- /dev/null
+++ b/ext/date/tests/date_sunrise_variation9.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test date_sunrise() function : usage variation - Passing high positive and negative float values to time argument.
+--FILE--
+<?php
+/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunrise() : usage variation ***\n";
+
+// GMT is zero for the timezone
+date_default_timezone_set("Asia/Calcutta");
+//Initialise the variables
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+
+echo "\n-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --\n";
+$time = 12.3456789000e10;
+var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+
+echo "\n-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --\n";
+$time = -12.3456789000e10;
+var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing date_sunrise\(\) : usage variation \*\*\*
+
+-- Testing date_sunrise\(\) function by passing float 12.3456789000e10 value to time --
+string\(5\) "(07:34|07:49)"
+float\((7.566[0-9]*|7.821[0-9]*)\)
+int\((-1097256359|123456811756)\)
+
+-- Testing date_sunrise\(\) function by passing float -12.3456789000e10 value to time --
+string\(5\) "(07:42|08:48|08:04)"
+float\((7.713[0-9]*|8.810[0-9]*|8.074[0-9]*)\)
+int\((1097304168|-2147443882|-123456761731)\)
+===DONE===
diff --git a/ext/date/tests/date_sunset_error.phpt b/ext/date/tests/date_sunset_error.phpt
new file mode 100644
index 0000000..a5e75b6
--- /dev/null
+++ b/ext/date/tests/date_sunset_error.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test date_sunset() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : error conditions ***\n";
+
+//Initialise the variables
+$time = time();
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+$extra_arg = 10;
+
+// Zero arguments
+echo "\n-- Testing date_sunset() function with Zero arguments --\n";
+var_dump( date_sunset() );
+
+//Test date_sunset with one more than the expected number of arguments
+echo "\n-- Testing date_sunset() function with more than expected no. of arguments --\n";
+var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
+var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
+var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : error conditions ***
+
+-- Testing date_sunset() function with Zero arguments --
+
+Warning: date_sunset() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_sunset() function with more than expected no. of arguments --
+
+Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation1.phpt b/ext/date/tests/date_sunset_variation1.phpt
new file mode 100644
index 0000000..c2e1195
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation1.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to first argument time.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+//Initialise the variables
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for time
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($value, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunset($value, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunset($value, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--int 1--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--int 12345--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--int -12345--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--float 10.5--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--float -10.5--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--float .5--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--lowercase null--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--lowercase true--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--lowercase false--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--uppercase TRUE--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--uppercase FALSE--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+
+--unset var--
+string(5) "18:22"
+float(18.377%d)
+int(62558)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation2.phpt b/ext/date/tests/date_sunset_variation2.phpt
new file mode 100644
index 0000000..575b64a
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation2.phpt
@@ -0,0 +1,211 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to second argument format.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 22.34;
+$longitude = 88.21;
+$zenith = 90;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, $value, $latitude, $longitude, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--float 10.5--
+
+Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float -10.5--
+
+Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float 12.3456789000e10--
+
+Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float -12.3456789000e10--
+
+Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d
+bool(false)
+
+--float .5--
+int(1218199253)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218199253)
+
+--lowercase null--
+int(1218199253)
+
+--lowercase true--
+string(5) "18:10"
+
+--lowercase false--
+int(1218199253)
+
+--uppercase TRUE--
+string(5) "18:10"
+
+--uppercase FALSE--
+int(1218199253)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218199253)
+
+--unset var--
+int(1218199253)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation3.phpt b/ext/date/tests/date_sunset_variation3.phpt
new file mode 100644
index 0000000..e0f6678
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation3.phpt
@@ -0,0 +1,297 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to third argument latitude.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$longitude = 88.21;
+$zenith = 90;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for latitude
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $value, $longitude, $zenith, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $value, $longitude, $zenith, $gmt_offset) );
+
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--int 1--
+string(5) "17:44"
+float(17.749%d)
+int(1218197698)
+
+--int 12345--
+bool(false)
+bool(false)
+bool(false)
+
+--int -12345--
+string(5) "17:35"
+float(17.598%d)
+int(1218197155)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--lowercase null--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--lowercase true--
+string(5) "17:44"
+float(17.749%d)
+int(1218197698)
+
+--lowercase false--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--uppercase TRUE--
+string(5) "17:44"
+float(17.749%d)
+int(1218197698)
+
+--uppercase FALSE--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 3 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+
+--unset var--
+string(5) "17:43"
+float(17.730%d)
+int(1218197630)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation4.phpt b/ext/date/tests/date_sunset_variation4.phpt
new file mode 100644
index 0000000..7840f8f
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation4.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to fourth argument longitude.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$latitude = 22.34;
+$zenith = 90;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for longitude
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $value, $zenith, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $value, $zenith, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $value, $zenith, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--int 1--
+string(5) "23:59"
+float(23.992%d)
+int(1218220174)
+
+--int 12345--
+string(5) "17:15"
+float(17.259%d)
+int(1218195932)
+
+--int -12345--
+string(5) "12:18"
+float(12.316%d)
+int(1218178138)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--lowercase null--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--lowercase true--
+string(5) "23:59"
+float(23.992%d)
+int(1218220174)
+
+--lowercase false--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--uppercase TRUE--
+string(5) "23:59"
+float(23.992%d)
+int(1218220174)
+
+--uppercase FALSE--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 4 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+
+--unset var--
+string(5) "00:03"
+float(0.059%d)
+int(1218220414)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation5.phpt b/ext/date/tests/date_sunset_variation5.phpt
new file mode 100644
index 0000000..0719633
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation5.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to fifth argument zenith.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$longitude = 88.21;
+$latitude = 22.34;
+$gmt_offset = 5.5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for zenith
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $value, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $value, $gmt_offset) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $value, $gmt_offset) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+bool(false)
+bool(false)
+bool(false)
+
+--int 1--
+bool(false)
+bool(false)
+bool(false)
+
+--int 12345--
+string(5) "19:20"
+float(19.340%d)
+int(1218203424)
+
+--int -12345--
+bool(false)
+bool(false)
+bool(false)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase null--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase true--
+bool(false)
+bool(false)
+bool(false)
+
+--lowercase false--
+bool(false)
+bool(false)
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+bool(false)
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+bool(false)
+bool(false)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 5 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+bool(false)
+bool(false)
+bool(false)
+
+--unset var--
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation6.phpt b/ext/date/tests/date_sunset_variation6.phpt
new file mode 100644
index 0000000..a434de8
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation6.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing unexpected values to sixth argument gmt_offset.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$time = mktime(8, 8, 8, 8, 8, 2008);
+$longitude = 88.21;
+$latitude = 22.34;
+$zenith = 90;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for gmt_offset
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $value) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $value) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--int 0--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--int 1--
+string(5) "13:40"
+float(13.681%d)
+int(1218199253)
+
+--int 12345--
+string(5) "21:40"
+float(21.681%d)
+int(1218199253)
+
+--int -12345--
+string(5) "19:40"
+float(19.681%d)
+int(1218199253)
+
+--empty array--
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--lowercase null--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--lowercase true--
+string(5) "13:40"
+float(13.681%d)
+int(1218199253)
+
+--lowercase false--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--uppercase TRUE--
+string(5) "13:40"
+float(13.681%d)
+int(1218199253)
+
+--uppercase FALSE--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--empty string DQ--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+Warning: date_sunset() expects parameter 6 to be double, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+
+--unset var--
+string(5) "12:40"
+float(12.681%d)
+int(1218199253)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation7.phpt b/ext/date/tests/date_sunset_variation7.phpt
new file mode 100644
index 0000000..0c64d96
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation7.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test date_sunset() function : usage variation - Checking sunrise for consecutive days in specific timezone
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+//Timezones with required data for date_sunrise
+$inputs = array (
+ //Timezone with Latitude, Longitude and GMT offset
+ "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
+ "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
+ "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
+ "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
+ "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => "-7.58", "GMT" => 0),
+ "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
+ "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
+ "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
+ "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
+);
+
+foreach($inputs as $timezone => $value) {
+ echo "\n--$timezone--\n";
+ date_default_timezone_set($timezone);
+ $time = mktime(8, 8, 8, 8, 11, 2008);
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
+ $time = mktime(8, 8, 8, 8, 12, 2008);
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--Pacific/Samoa--
+string(5) "18:13"
+string(5) "18:13"
+
+--US/Alaska--
+string(5) "21:00"
+string(5) "20:57"
+
+--America/Chicago--
+string(5) "19:51"
+string(5) "19:50"
+
+--America/Montevideo--
+string(5) "18:08"
+string(5) "18:09"
+
+--Africa/Casablanca--
+string(5) "19:17"
+string(5) "19:16"
+
+--Europe/Moscow--
+string(5) "21:09"
+string(5) "21:07"
+
+--Asia/Hong_Kong--
+string(5) "18:55"
+string(5) "18:54"
+
+--Australia/Brisbane--
+string(5) "17:21"
+string(5) "17:21"
+
+--Pacific/Wallis--
+string(5) "17:36"
+string(5) "17:36"
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation8.phpt b/ext/date/tests/date_sunset_variation8.phpt
new file mode 100644
index 0000000..07319ab
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation8.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test date_sunset() function : usage variation - Checking with North and South poles when Sun is up and down all day
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunrise for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// GMT is zero for the timezone
+date_default_timezone_set("Africa/Casablanca");
+$time_date = array (
+
+ //Date at which Sun is up all day at North Pole
+ "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
+ "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008),
+
+ //Date at which Sun is up all day at South Pole
+ "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
+ "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008),
+);
+
+//Iterate over different date and time
+foreach( $time_date as $date => $time ){
+ echo "\n--$date--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_sunset() : usage variation ***
+
+--12 Aug 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--13 Aug 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--12 Nov 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--13 Nov 2008--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_sunset_variation9.phpt b/ext/date/tests/date_sunset_variation9.phpt
new file mode 100644
index 0000000..59a4b58
--- /dev/null
+++ b/ext/date/tests/date_sunset_variation9.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test date_sunset() function : usage variation - Passing high positive and negative float values to time argument.
+--FILE--
+<?php
+/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
+ * Description: Returns time of sunset for a given day and location
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing date_sunset() : usage variation ***\n";
+
+// GMT is zero for the timezone
+date_default_timezone_set("Asia/Calcutta");
+//Initialise the variables
+$latitude = 38.4;
+$longitude = -9;
+$zenith = 90;
+$gmt_offset = 1;
+
+echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --\n";
+$time = 12.3456789000e10;
+var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+
+echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --\n";
+$time = -12.3456789000e10;
+var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
+var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing date_sunset\(\) : usage variation \*\*\*
+
+-- Testing date_sunset\(\) function by passing float 12.3456789000e10 value to time --
+string\(5\) "(19:49|19:28)"
+float\((19.830[0-9]*|19.830[0-9]*|19.480[0-9]*)\)
+int\((-1097212211|123456853728)\)
+
+-- Testing date_sunset\(\) function by passing float -12.3456789000e10 value to time --
+string\(5\) "(19:03|18:12|18:48)"
+float\((19.056[0-9]*|18.213[0-9]*|18.808[0-9]*)\)
+int\((1097345002|-2147410031|-123456723090)\)
+===DONE===
diff --git a/ext/date/tests/date_time_set_basic1.phpt b/ext/date/tests/date_time_set_basic1.phpt
new file mode 100644
index 0000000..c0c9c66
--- /dev/null
+++ b/ext/date/tests/date_time_set_basic1.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test date_time_set() function : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTime
+ */
+
+ //Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_time_set() : basic functionality ***\n";
+
+// Create a DateTime object
+$datetime = date_create("2009-01-31 15:14:10");
+
+echo "Initial date: " . date_format($datetime, DATE_RFC2822) . "\n";
+
+date_time_set($datetime, 17, 20);
+echo "After modification1 " . date_format($datetime, DATE_RFC2822) . "\n";
+
+date_time_set($datetime, 19, 05, 59);
+echo "After modification2 " . date_format($datetime, DATE_RFC2822) . "\n";
+
+date_time_set($datetime, 24, 10);
+echo "After modification3 " . date_format($datetime, DATE_RFC2822) . "\n";
+
+date_time_set($datetime, 47, 35, 47);
+echo "After modification4 " . date_format($datetime, DATE_RFC2822) . "\n";
+
+date_time_set($datetime, 54, 25);
+echo "After modification5 " . date_format($datetime, DATE_RFC2822) . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_time_set() : basic functionality ***
+Initial date: Sat, 31 Jan 2009 15:14:10 +0000
+After modification1 Sat, 31 Jan 2009 17:20:00 +0000
+After modification2 Sat, 31 Jan 2009 19:05:59 +0000
+After modification3 Sun, 01 Feb 2009 00:10:00 +0000
+After modification4 Mon, 02 Feb 2009 23:35:47 +0000
+After modification5 Wed, 04 Feb 2009 06:25:00 +0000
+===DONE===
diff --git a/ext/date/tests/date_time_set_error.phpt b/ext/date/tests/date_time_set_error.phpt
new file mode 100644
index 0000000..8e5c855
--- /dev/null
+++ b/ext/date/tests/date_time_set_error.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test date_time_set() function : error conditions
+--FILE--
+<?php
+/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTime
+ */
+
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_time_set() : error conditions ***\n";
+
+echo "\n-- Testing date_time_set() function with zero arguments --\n";
+var_dump( date_time_set() );
+
+echo "\n-- Testing date_time_set() function with less than expected no. of arguments --\n";
+$datetime = date_create("2009-01-31 15:34:10");
+$hour = 18;
+var_dump( date_time_set($datetime) );
+var_dump( date_time_set($datetime, $hour) );
+
+echo "\n-- Testing date_time_set() function with more than expected no. of arguments --\n";
+$min = 15;
+$sec = 30;
+$extra_arg = 10;
+var_dump( date_time_set($datetime, $hour, $min, $sec, $extra_arg) );
+
+echo "\n-- Testing date_time_set() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( date_time_set($invalid_obj, $hour, $min, $sec) );
+$invalid_obj = 10;
+var_dump( date_time_set($invalid_obj, $hour, $min, $sec) );
+$invalid_obj = null;
+var_dump( date_time_set($invalid_obj, $hour, $min, $sec) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_time_set() : error conditions ***
+
+-- Testing date_time_set() function with zero arguments --
+
+Warning: date_time_set() expects at least 3 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_time_set() function with less than expected no. of arguments --
+
+Warning: date_time_set() expects at least 3 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: date_time_set() expects at least 3 parameters, 2 given in %s on line %d
+bool(false)
+
+-- Testing date_time_set() function with more than expected no. of arguments --
+
+Warning: date_time_set() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing date_time_set() function with an invalid values for $object argument --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+Warning: date_time_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_time_set_variation1.phpt b/ext/date/tests/date_time_set_variation1.phpt
new file mode 100644
index 0000000..651f8a0
--- /dev/null
+++ b/ext/date/tests/date_time_set_variation1.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test date_time_set() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTime
+ */
+
+echo "*** Testing date_time_set() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$hour = 10;
+$minute = 13;
+$sec = 45;
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( date_time_set($object, $hour, $minute, $sec) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_time_set() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_time_set() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_time_set_variation2.phpt b/ext/date/tests/date_time_set_variation2.phpt
new file mode 100644
index 0000000..e8a6d7e
--- /dev/null
+++ b/ext/date/tests/date_time_set_variation2.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_time_set() function : usage variation - Passing unexpected values to second argument $hour.
+--FILE--
+<?php
+/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTime
+ */
+
+echo "*** Testing date_time_set() : usage variation - unexpected values to second argument \$hour***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-01-31 15:14:10");
+$minute = 13;
+$sec = 45;
+
+foreach($inputs as $variation =>$hour) {
+ echo "\n-- $variation --\n";
+ var_dump( date_time_set($object, $hour, $minute, $sec) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_time_set() : usage variation - unexpected values to second argument $hour***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 01:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2010-06-29 09:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 15:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 14:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_time_set() expects parameter 2 to be long, array given in %s
+bool(false)
+
+-- int indexed array --
+
+Warning: date_time_set() expects parameter 2 to be long, array given in %s
+bool(false)
+
+-- associative array --
+
+Warning: date_time_set() expects parameter 2 to be long, array given in %s
+bool(false)
+
+-- nested arrays --
+
+Warning: date_time_set() expects parameter 2 to be long, array given in %s
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 01:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 01:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_time_set() expects parameter 2 to be long, string given in %s
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_time_set() expects parameter 2 to be long, string given in %s
+bool(false)
+
+-- string DQ --
+
+Warning: date_time_set() expects parameter 2 to be long, string given in %s
+bool(false)
+
+-- string SQ --
+
+Warning: date_time_set() expects parameter 2 to be long, string given in %s
+bool(false)
+
+-- mixed case string --
+
+Warning: date_time_set() expects parameter 2 to be long, string given in %s
+bool(false)
+
+-- heredoc --
+
+Warning: date_time_set() expects parameter 2 to be long, string given in %s
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_time_set() expects parameter 2 to be long, object given in %s
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_time_set() expects parameter 2 to be long, object given in %s
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-29 00:13:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_time_set() expects parameter 2 to be long, resource given in %s
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_time_set_variation3.phpt b/ext/date/tests/date_time_set_variation3.phpt
new file mode 100644
index 0000000..9be25b5
--- /dev/null
+++ b/ext/date/tests/date_time_set_variation3.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_time_set() function : usage variation - Passing unexpected values to third argument $minute.
+--FILE--
+<?php
+/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTime
+ */
+
+echo "*** Testing date_time_set() : usage variation - unexpected values to third argument \$minute***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-01-31 15:14:10");
+$hour = 10;
+$sec = 45;
+
+foreach($inputs as $variation =>$minute) {
+ echo "\n-- $variation --\n";
+ var_dump( date_time_set($object, $hour, $minute, $sec) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_time_set() : usage variation - unexpected values to third argument $minute***
+
+-- int 0 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:01:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-02-08 23:45:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-01-30 20:15:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:10:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-01-30 09:50:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_time_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_time_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_time_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_time_set() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:01:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:01:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_time_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_time_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_time_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_time_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_time_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_time_set() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_time_set() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_time_set() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-30 10:00:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_time_set() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/date_time_set_variation4.phpt b/ext/date/tests/date_time_set_variation4.phpt
new file mode 100644
index 0000000..1da497b
--- /dev/null
+++ b/ext/date/tests/date_time_set_variation4.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test date_time_set() function : usage variation - Passing unexpected values to forth argument $sec.
+--FILE--
+<?php
+/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] )
+ * Description: Resets the current time of the DateTime object to a different time.
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTime
+ */
+
+echo "*** Testing date_time_set() : usage variation - unexpected values to forth argument \$sec***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-01-31 15:14:10");
+$hour = 10;
+$minute = 13;
+
+foreach($inputs as $variation =>$sec) {
+ echo "\n-- $variation --\n";
+ var_dump( date_time_set($object, $hour, $minute, $sec) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_time_set() : usage variation - unexpected values to forth argument $sec***
+
+-- int 0 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 1 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:01"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int 12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 13:38:45"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- int -12345 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 06:47:15"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float 10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:10"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float -10.5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:12:50"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- float .5 --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty array --
+
+Warning: date_time_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_time_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_time_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_time_set() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase null --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase true --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:01"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- lowercase false --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase TRUE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:01"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- uppercase FALSE --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- empty string DQ --
+
+Warning: date_time_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_time_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_time_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_time_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_time_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_time_set() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_time_set() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_time_set() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- unset var --
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(19) "2009-01-31 10:13:00"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+
+-- resource --
+
+Warning: date_time_set() expects parameter 4 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_timestamp_get.phpt b/ext/date/tests/date_timestamp_get.phpt
new file mode 100644
index 0000000..bdd4d04
--- /dev/null
+++ b/ext/date/tests/date_timestamp_get.phpt
@@ -0,0 +1,20 @@
+--TEST--
+DateTime: Test correct setup and correct DateTime parameter to date_timestamp_get()
+--CREDITS--
+Havard Eide <nucleuz@gmail.com>
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$tz = date_timestamp_get(new DateTime());
+var_dump(is_int($tz));
+echo "\n\n";
+$tz = date_timestamp_get(time());
+?>
+--EXPECTF--
+bool(true)
+
+
+
+Warning: date_timestamp_get() expects parameter 1 to be DateTime, integer given in %s on line %d \ No newline at end of file
diff --git a/ext/date/tests/date_timezone_get_basic1.phpt b/ext/date/tests/date_timezone_get_basic1.phpt
new file mode 100644
index 0000000..f77352e
--- /dev/null
+++ b/ext/date/tests/date_timezone_get_basic1.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test date_timezone_get() function : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTimeZone date_timezone_get ( DateTime $object )
+ * Description: Return time zone relative to given DateTime
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTimezone
+ */
+
+echo "*** Testing date_timezone_get() : basic functionality ***\n";
+
+date_default_timezone_set("Europe/London");
+$object = date_create("2009-01-30 17:57:32");
+$tz = date_timezone_get($object);
+var_dump( timezone_name_get($tz) );
+
+date_default_timezone_set("America/New_York");
+$object = date_create("2009-01-30 17:57:32");
+$tz = date_timezone_get($object);
+var_dump( timezone_name_get($tz) );
+
+$la_time = timezone_open("America/Los_Angeles");
+date_timezone_set($object, $la_time);
+$tz = date_timezone_get($object);
+var_dump( timezone_name_get($tz) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_timezone_get() : basic functionality ***
+string(13) "Europe/London"
+string(16) "America/New_York"
+string(19) "America/Los_Angeles"
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/date_timezone_get_error.phpt b/ext/date/tests/date_timezone_get_error.phpt
new file mode 100644
index 0000000..1310cbe
--- /dev/null
+++ b/ext/date/tests/date_timezone_get_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test date_timezone_get() function : error conditions
+--FILE--
+<?php
+/* Prototype : DateTimeZone date_timezone_get ( DateTime $object )
+ * Description: Return time zone relative to given DateTime
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::getTimezone
+ */
+
+// Set timezone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing date_timezone_get() : error conditions ***\n";
+
+echo "\n-- Testing date_timezone_get() function with zero arguments --\n";
+var_dump( date_timezone_get() );
+
+echo "\n-- Testing date_timezone_get() function with more than expected no. of arguments --\n";
+$datetime = date_create("2009-01-30 17:57:32");
+$extra_arg = 99;
+var_dump( date_timezone_get($datetime, $extra_arg) );
+
+echo "\n-- Testing date_timezone_get() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( date_timezone_get($invalid_obj) );
+$invalid_obj = 10;
+var_dump( date_timezone_get($invalid_obj) );
+$invalid_obj = null;
+var_dump( date_timezone_get($invalid_obj) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_timezone_get() : error conditions ***
+
+-- Testing date_timezone_get() function with zero arguments --
+
+Warning: date_timezone_get() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_timezone_get() function with more than expected no. of arguments --
+
+Warning: date_timezone_get() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing date_timezone_get() function with an invalid values for $object argument --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_timezone_get_variation1.phpt b/ext/date/tests/date_timezone_get_variation1.phpt
new file mode 100644
index 0000000..3b2034e
--- /dev/null
+++ b/ext/date/tests/date_timezone_get_variation1.phpt
@@ -0,0 +1,250 @@
+--TEST--
+Test date_timezone_get() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : DateTimeZone date_timezone_get ( DateTime $object )
+ * Description: Return time zone relative to given DateTime
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::getTimezone
+ */
+
+echo "*** Testing date_timezone_get() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( date_timezone_get($object) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_timezone_get() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_timezone_get() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_timezone_set_basic1.phpt b/ext/date/tests/date_timezone_set_basic1.phpt
new file mode 100644
index 0000000..2e9154c
--- /dev/null
+++ b/ext/date/tests/date_timezone_set_basic1.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test date_timezone_set() function : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTime date_timezone_set ( DateTime $object , DateTimeZone $timezone )
+ * Description: Sets the time zone for the DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTimezone
+ */
+
+echo "*** Testing date_timezone_set() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+$datetime = date_create("2009-01-30 17:57:32");
+$tz = date_timezone_get($datetime);
+echo "Default timezone: " . timezone_name_get($tz) . "\n";
+
+$datetime = date_create("2009-01-30 22:57:32");
+$la_time = timezone_open("America/Los_Angeles");
+
+date_timezone_set($datetime, $la_time);
+$tz = date_timezone_get($datetime);
+echo "New timezone: " . timezone_name_get($tz) . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_timezone_set() : basic functionality ***
+Default timezone: Europe/London
+New timezone: America/Los_Angeles
+===DONE===
+
diff --git a/ext/date/tests/date_timezone_set_error.phpt b/ext/date/tests/date_timezone_set_error.phpt
new file mode 100644
index 0000000..8c9c00d
--- /dev/null
+++ b/ext/date/tests/date_timezone_set_error.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test date_timezone_set() function : error conditions
+--FILE--
+<?php
+/* Prototype : DateTime date_timezone_set ( DateTime $object , DateTimeZone $timezone )
+ * Description: Sets the time zone for the DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTimezone
+ */
+
+date_default_timezone_set("UTC");
+
+echo "*** Testing date_timezone_set() : error conditions ***\n";
+
+echo "\n-- Testing date_timezone_set() function with zero arguments --\n";
+var_dump( date_timezone_set() );
+
+echo "\n-- Testing date_timezone_set() function with less than expected no. of arguments --\n";
+$datetime = date_create("2009-01-30 17:57:32");
+var_dump( date_timezone_set($datetime) );
+
+echo "\n-- Testing date_timezone_set() function with more than expected no. of arguments --\n";
+$timezone = timezone_open("GMT");
+$extra_arg = 99;
+var_dump( date_timezone_set($datetime, $timezone, $extra_arg) );
+
+echo "\n-- Testing date_timezone_set() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( date_timezone_set($invalid_obj, $timezone) );
+$invalid_obj = 10;
+var_dump( date_timezone_set($invalid_obj, $timezone) );
+$invalid_obj = null;
+var_dump( date_timezone_set($invalid_obj, $timezone) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_timezone_set() : error conditions ***
+
+-- Testing date_timezone_set() function with zero arguments --
+
+Warning: date_timezone_set() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_timezone_set() function with less than expected no. of arguments --
+
+Warning: date_timezone_set() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing date_timezone_set() function with more than expected no. of arguments --
+
+Warning: date_timezone_set() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+
+-- Testing date_timezone_set() function with an invalid values for $object argument --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_timezone_set_variation1.phpt b/ext/date/tests/date_timezone_set_variation1.phpt
new file mode 100644
index 0000000..cde2d69
--- /dev/null
+++ b/ext/date/tests/date_timezone_set_variation1.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test date_timezone_set() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : DateTime date_timezone_set ( DateTime $object , DateTimeZone $timezone )
+ * Description: Sets the time zone for the DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTimezone
+ */
+
+echo "*** Testing date_timezone_set() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$timezone = timezone_open("America/Los_Angeles");
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( date_timezone_set($object, $timezone) );
+};
+
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_timezone_set() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_timezone_set() expects parameter 1 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/date_timezone_set_variation2.phpt b/ext/date/tests/date_timezone_set_variation2.phpt
new file mode 100644
index 0000000..b85ddef
--- /dev/null
+++ b/ext/date/tests/date_timezone_set_variation2.phpt
@@ -0,0 +1,252 @@
+--TEST--
+Test date_timezone_set() function : usage variation - Passing unexpected values to second argument $timezone.
+--FILE--
+<?php
+/* Prototype : DateTime date_timezone_set ( DateTime $object , DateTimeZone $timezone )
+ * Description: Sets the time zone for the DateTime object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::setTimezone
+ */
+
+echo "*** Testing date_timezone_set() : usage variation - unexpected values to second argument \$timezone***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = date_create("2009-01-30 17:57:32");
+
+foreach($inputs as $variation =>$timezone) {
+ echo "\n-- $variation --\n";
+ var_dump( date_timezone_set($object, $timezone) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date_timezone_set() : usage variation - unexpected values to second argument $timezone***
+
+-- int 0 --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/date_variation1.phpt b/ext/date/tests/date_variation1.phpt
new file mode 100644
index 0000000..a719359
--- /dev/null
+++ b/ext/date/tests/date_variation1.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test date() function : usage variation - Passing unexpected values to first argument $format.
+--FILE--
+<?php
+/* Prototype : string date ( string $format [, int $timestamp ] )
+ * Description: Format a local time/date.
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date() : usage variation - unexpected values to first argument \$format***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$timestamp = mktime(10, 44, 30, 2, 27, 2009);
+
+foreach($inputs as $variation =>$format) {
+ echo "\n-- $variation --\n";
+ var_dump( date($format, $timestamp) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date() : usage variation - unexpected values to first argument $format***
+
+-- int 0 --
+string(1) "0"
+
+-- int 1 --
+string(1) "1"
+
+-- int 12345 --
+string(5) "12345"
+
+-- int -12345 --
+string(6) "-12345"
+
+-- float 10.5 --
+string(4) "10.5"
+
+-- float -10.5 --
+string(5) "-10.5"
+
+-- float .5 --
+string(3) "0.5"
+
+-- empty array --
+
+Warning: date() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+string(0) ""
+
+-- lowercase null --
+string(0) ""
+
+-- lowercase true --
+string(1) "1"
+
+-- lowercase false --
+string(0) ""
+
+-- uppercase TRUE --
+string(1) "1"
+
+-- uppercase FALSE --
+string(0) ""
+
+-- empty string DQ --
+string(0) ""
+
+-- empty string SQ --
+string(0) ""
+
+-- string DQ --
+string(40) "3028Fri, 27 Feb 2009 10:44:30 +000044210"
+
+-- string SQ --
+string(40) "3028Fri, 27 Feb 2009 10:44:30 +000044210"
+
+-- mixed case string --
+string(40) "30GMTFri, 27 Feb 2009 10:44:30 +00000210"
+
+-- heredoc --
+string(76) "10Europe/LondonFridayFriday2009 52009Fri, 27 Feb 2009 10:44:30 +0000Friday27"
+
+-- instance of classWithToString --
+string(64) "CFridayam3030 AM 2009b27Europe/London2009-02-27T10:44:30+00:0028"
+
+-- instance of classWithoutToString --
+
+Warning: date() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+string(0) ""
+
+-- unset var --
+string(0) ""
+
+-- resource --
+
+Warning: date() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/date_variation2.phpt b/ext/date/tests/date_variation2.phpt
new file mode 100644
index 0000000..f30e6ed
--- /dev/null
+++ b/ext/date/tests/date_variation2.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test date() function : usage variation - Passing unexpected values to second argument $timestamp.
+--FILE--
+<?php
+/* Prototype : string date ( string $format [, int $timestamp ] )
+ * Description: Format a local time/date.
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing date() : usage variation - unexpected values to second argument \$timestamp***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$format = "F j, Y, g:i a";
+
+foreach($inputs as $variation =>$timestamp) {
+ echo "\n-- $variation --\n";
+ var_dump( date($format, $timestamp) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing date() : usage variation - unexpected values to second argument $timestamp***
+
+-- int 0 --
+string(24) "January 1, 1970, 1:00 am"
+
+-- int 1 --
+string(24) "January 1, 1970, 1:00 am"
+
+-- int 12345 --
+string(24) "January 1, 1970, 4:25 am"
+
+-- int -12345 --
+string(26) "December 31, 1969, 9:34 pm"
+
+-- float 10.5 --
+string(24) "January 1, 1970, 1:00 am"
+
+-- float -10.5 --
+string(25) "January 1, 1970, 12:59 am"
+
+-- float .5 --
+string(24) "January 1, 1970, 1:00 am"
+
+-- empty array --
+
+Warning: date() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: date() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: date() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: date() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+string(24) "January 1, 1970, 1:00 am"
+
+-- lowercase null --
+string(24) "January 1, 1970, 1:00 am"
+
+-- lowercase true --
+string(24) "January 1, 1970, 1:00 am"
+
+-- lowercase false --
+string(24) "January 1, 1970, 1:00 am"
+
+-- uppercase TRUE --
+string(24) "January 1, 1970, 1:00 am"
+
+-- uppercase FALSE --
+string(24) "January 1, 1970, 1:00 am"
+
+-- empty string DQ --
+
+Warning: date() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: date() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: date() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: date() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: date() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: date() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: date() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: date() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+string(24) "January 1, 1970, 1:00 am"
+
+-- unset var --
+string(24) "January 1, 1970, 1:00 am"
+
+-- resource --
+
+Warning: date() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/default-timezone-1.phpt b/ext/date/tests/default-timezone-1.phpt
new file mode 100644
index 0000000..a53d370
--- /dev/null
+++ b/ext/date/tests/default-timezone-1.phpt
@@ -0,0 +1,10 @@
+--TEST--
+date.timezone setting [1]
+--FILE--
+<?php
+date_default_timezone_set('GMT');
+ putenv('TZ='); // clean TZ so that it doesn't bypass the ini option
+ echo strtotime("2005-06-18 22:15:44");
+?>
+--EXPECT--
+1119132944
diff --git a/ext/date/tests/default-timezone-2.phpt b/ext/date/tests/default-timezone-2.phpt
new file mode 100644
index 0000000..b414eb2
--- /dev/null
+++ b/ext/date/tests/default-timezone-2.phpt
@@ -0,0 +1,10 @@
+--TEST--
+date.timezone setting [2]
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+ putenv('TZ='); // clean TZ so that it doesn't bypass the ini option
+ echo strtotime("2005-06-18 22:15:44");
+?>
+--EXPECT--
+1119125744
diff --git a/ext/date/tests/examine_diff.inc b/ext/date/tests/examine_diff.inc
new file mode 100644
index 0000000..c3dcba9
--- /dev/null
+++ b/ext/date/tests/examine_diff.inc
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ * Helper for the DateTime diff/days/math tests
+ *
+ * @author Daniel Convissor <danielc@analysisandsolutions.com>
+ */
+
+/**#@+
+ * Which test segments should be displayed?
+ */
+define('PHPT_DATETIME_SHOW_DIFF', 1);
+define('PHPT_DATETIME_SHOW_DAYS', 2);
+define('PHPT_DATETIME_SHOW_ADD', 3);
+define('PHPT_DATETIME_SHOW_SUB', 4);
+/**#@-*/
+
+/**
+ * Provides a consistent interface for executing date diff/add/sub tests
+ *
+ * @param string|DateTime $end_date the end date in YYYY-MM-DD format
+ * (can include time HH:MM:SS) or a DateTime object
+ * @param string|DateTime $start_date the start date in YYYY-MM-DD format
+ * (can include time HH:MM:SS) or a DateTime object
+ * @param string $expect_spec the expected result of the tests, in the
+ * special interval specification used for this test suite.
+ * This spec includes a "+" or "-" after the "P" in order to
+ * indicate which direction to go.
+ * @param int $expect_days the number of days to compare with the
+ * interval's "days" property
+ * @param bool $absolute should the result always be a positive number?
+ *
+ * @return void
+ */
+function examine_diff($end_date, $start_date, $expect_spec, $expect_days, $absolute = false) {
+ if (is_string($start_date)) {
+ $start = new DateTime($start_date);
+ } else {
+ $start = $start_date;
+ }
+ $start_date = $start->format('Y-m-d H:i:s T');
+
+ if (is_string($end_date)) {
+ $end = new DateTime($end_date);
+ } else {
+ $end = $end_date;
+ }
+ $end_date = $end->format('Y-m-d H:i:s T');
+
+ $expect_interval = new DateInterval('P' . substr($expect_spec, 2));
+ if (substr($expect_spec, 1, 1) == '-') {
+ $expect_interval->invert = true;
+ }
+
+ if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DIFF) {
+ $result_interval = $start->diff($end, $absolute);
+ $result_spec = $result_interval->format('P%R%yY%mM%dDT%hH%iM%sS');
+ echo "DIFF: $end_date - $start_date = **$result_spec**\n";
+ // echo "DIFF: $end_date - $start_date = **$expect_spec**\n";
+ }
+ if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DAYS) {
+ $result_interval = $start->diff($end, $absolute);
+ $result_days = $result_interval->format('%a');
+ echo "DAYS: **$result_days**\n";
+ // echo "DAYS: **$expect_days**\n";
+ }
+ if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_ADD) {
+ $start->add($expect_interval);
+ $result_end_date = $start->format('Y-m-d H:i:s T');
+ echo "ADD: $start_date + $expect_spec = **$result_end_date**\n";
+ // echo "ADD: $start_date + $expect_spec = **$end_date**\n";
+ }
+ if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_SUB) {
+ $end->sub($expect_interval);
+ $result_start_date = $end->format('Y-m-d H:i:s T');
+ echo "SUB: $end_date - $expect_spec = **$result_start_date**\n";
+ // echo "SUB: $end_date - $expect_spec = **$start_date**\n";
+ }
+}
diff --git a/ext/date/tests/format-negative-timestamp.phpt b/ext/date/tests/format-negative-timestamp.phpt
new file mode 100644
index 0000000..5fd6a65
--- /dev/null
+++ b/ext/date/tests/format-negative-timestamp.phpt
@@ -0,0 +1,24 @@
+--TEST--
+strtotime() - Format: @timestamps
+--FILE--
+<?php
+date_default_timezone_set("GMT");
+
+$i = 5;
+$max = getrandmax();
+$max_2 = $max / 2;
+
+while($i--) {
+ $new_tm = rand(1, $max);
+ if ($new_tm > $max_2)
+ $new_tm *= -1;
+
+ if (strtotime("@$new_tm") != $new_tm) {
+ echo "Error when parsing: @$new_tm\n";
+ }
+}
+
+echo "done!";
+?>
+--EXPECT--
+done!
diff --git a/ext/date/tests/getdate_basic.phpt b/ext/date/tests/getdate_basic.phpt
new file mode 100644
index 0000000..5d6cc81
--- /dev/null
+++ b/ext/date/tests/getdate_basic.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test getdate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing getdate() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+// Initialise all required variables
+$timestamp = 10;
+
+// Calling getdate() with all possible arguments
+var_dump( getdate($timestamp) );
+
+// Calling getdate() with mandatory arguments
+var_dump( getdate() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : basic functionality ***
+array(11) {
+ ["seconds"]=>
+ int(10)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(10)
+}
+array(11) {
+ ["seconds"]=>
+ int(%d)
+ ["minutes"]=>
+ int(%d)
+ ["hours"]=>
+ int(%d)
+ ["mday"]=>
+ int(%d)
+ ["wday"]=>
+ int(%d)
+ ["mon"]=>
+ int(%d)
+ ["year"]=>
+ int(%d)
+ ["yday"]=>
+ int(%d)
+ ["weekday"]=>
+ string(%d) %s
+ ["month"]=>
+ string(%d) %s
+ [0]=>
+ int(%d)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_error.phpt b/ext/date/tests/getdate_error.phpt
new file mode 100644
index 0000000..149d066
--- /dev/null
+++ b/ext/date/tests/getdate_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test getdate() function : error conditions
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : error conditions ***\n";
+
+//Set the default time zone
+date_default_timezone_set("America/Chicago");
+
+//Test getdate with one more than the expected number of arguments
+echo "\n-- Testing getdate() function with more than expected no. of arguments --\n";
+$timestamp = 10;
+$extra_arg = 10;
+var_dump( getdate($timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : error conditions ***
+
+-- Testing getdate() function with more than expected no. of arguments --
+
+Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/getdate_variation1.phpt b/ext/date/tests/getdate_variation1.phpt
new file mode 100644
index 0000000..74754c9
--- /dev/null
+++ b/ext/date/tests/getdate_variation1.phpt
@@ -0,0 +1,443 @@
+--TEST--
+Test getdate() function : usage variation - Passing unexpected values to first argument timestamp.
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--float 10.5--
+array(11) {
+ ["seconds"]=>
+ int(10)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(10)
+}
+
+--float -10.5--
+array(11) {
+ ["seconds"]=>
+ int(50)
+ ["minutes"]=>
+ int(29)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(-10)
+}
+
+--float .5--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--empty array--
+
+Warning: getdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: getdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: getdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: getdate() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--lowercase null--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--lowercase true--
+array(11) {
+ ["seconds"]=>
+ int(1)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(1)
+}
+
+--lowercase false--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--uppercase TRUE--
+array(11) {
+ ["seconds"]=>
+ int(1)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(1)
+}
+
+--uppercase FALSE--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--empty string DQ--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: getdate() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: getdate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: getdate() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--unset var--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation2.phpt b/ext/date/tests/getdate_variation2.phpt
new file mode 100644
index 0000000..f987d21
--- /dev/null
+++ b/ext/date/tests/getdate_variation2.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test getdate() function : usage variation - Passing octal timestamp values
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ //octal values
+ 'octal 05' => 05,
+ 'octal 010' => 010,
+ 'octal -010' => -010,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--octal 05--
+array(11) {
+ ["seconds"]=>
+ int(5)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(5)
+}
+
+--octal 010--
+array(11) {
+ ["seconds"]=>
+ int(8)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(8)
+}
+
+--octal -010--
+array(11) {
+ ["seconds"]=>
+ int(52)
+ ["minutes"]=>
+ int(29)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(-8)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation3.phpt b/ext/date/tests/getdate_variation3.phpt
new file mode 100644
index 0000000..f7d6863
--- /dev/null
+++ b/ext/date/tests/getdate_variation3.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test getdate() function : usage variation - Passing hexadcimal timestamp values
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ //octal values
+ 'hexadcimal 0x5' => 0x5,
+ 'hexadcimal 0xCAFE' => 0xCAFE,
+ 'octal -0xCAFE' => -0xCAFE,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--hexadcimal 0x5--
+array(11) {
+ ["seconds"]=>
+ int(5)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(5)
+}
+
+--hexadcimal 0xCAFE--
+array(11) {
+ ["seconds"]=>
+ int(6)
+ ["minutes"]=>
+ int(56)
+ ["hours"]=>
+ int(19)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(51966)
+}
+
+--octal -0xCAFE--
+array(11) {
+ ["seconds"]=>
+ int(54)
+ ["minutes"]=>
+ int(3)
+ ["hours"]=>
+ int(15)
+ ["mday"]=>
+ int(31)
+ ["wday"]=>
+ int(3)
+ ["mon"]=>
+ int(12)
+ ["year"]=>
+ int(1969)
+ ["yday"]=>
+ int(364)
+ ["weekday"]=>
+ string(9) "Wednesday"
+ ["month"]=>
+ string(8) "December"
+ [0]=>
+ int(-51966)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation4.phpt b/ext/date/tests/getdate_variation4.phpt
new file mode 100644
index 0000000..92719ac
--- /dev/null
+++ b/ext/date/tests/getdate_variation4.phpt
@@ -0,0 +1,141 @@
+--TEST--
+Test getdate() function : usage variation - Verifyig by supplying year-wise sample time stamps since Unix epoch time
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ //Year wise time stamps
+ '01 Jan 1970' => 0,
+ '01 Jan 1971' => 31536000,
+ '01 Jan 1972' => 63072000,
+ '01 Jan 1973' => 94694400,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--01 Jan 1970--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--01 Jan 1971--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(5)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1971)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(6) "Friday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(31536000)
+}
+
+--01 Jan 1972--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(6)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1972)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Saturday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(63072000)
+}
+
+--01 Jan 1973--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(1)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1973)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(6) "Monday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(94694400)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation5.phpt b/ext/date/tests/getdate_variation5.phpt
new file mode 100644
index 0000000..e4524a8
--- /dev/null
+++ b/ext/date/tests/getdate_variation5.phpt
@@ -0,0 +1,223 @@
+--TEST--
+Test getdate() function : usage variation - Verifyig with different timezones on Unix epoch timestamp
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+//Timezones with required data for date_sunrise
+$inputs = array (
+ //GMT-11
+ "Pacific/Samoa",
+ //GMT-9
+ "US/Alaska",
+ //GMT-0
+ "Africa/Casablanca",
+ //GMT+4
+ "Europe/Moscow",
+ //GMT+8
+ "Asia/Hong_Kong",
+ //GMT+10
+ "Australia/Brisbane",
+ //GMT+12
+ "Pacific/Wallis",
+);
+
+// loop through each element of the array for timestamp
+foreach($inputs as $timezone) {
+ echo "\n--$timezone--\n";
+ date_default_timezone_set($timezone);
+ var_dump( getdate(0) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--Pacific/Samoa--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(13)
+ ["mday"]=>
+ int(31)
+ ["wday"]=>
+ int(3)
+ ["mon"]=>
+ int(12)
+ ["year"]=>
+ int(1969)
+ ["yday"]=>
+ int(364)
+ ["weekday"]=>
+ string(9) "Wednesday"
+ ["month"]=>
+ string(8) "December"
+ [0]=>
+ int(0)
+}
+
+--US/Alaska--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(14)
+ ["mday"]=>
+ int(31)
+ ["wday"]=>
+ int(3)
+ ["mon"]=>
+ int(12)
+ ["year"]=>
+ int(1969)
+ ["yday"]=>
+ int(364)
+ ["weekday"]=>
+ string(9) "Wednesday"
+ ["month"]=>
+ string(8) "December"
+ [0]=>
+ int(0)
+}
+
+--Africa/Casablanca--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(0)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--Europe/Moscow--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(3)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--Asia/Hong_Kong--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(8)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--Australia/Brisbane--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(10)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--Pacific/Wallis--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(0)
+ ["hours"]=>
+ int(12)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation6.phpt b/ext/date/tests/getdate_variation6.phpt
new file mode 100644
index 0000000..5c03a3b
--- /dev/null
+++ b/ext/date/tests/getdate_variation6.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test getdate() function : usage variation - Passing strings containing numbers
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+//Timezones with required data for date_sunrise
+$inputs = array (
+ 'String 0' => '0',
+ 'String 10.5' => "10.5",
+ 'String -10.5' => '-10.5',
+);
+
+// loop through each element of the array for timestamp
+foreach($inputs as $key => $value) {
+ echo "\n--$key--\n";
+ var_dump( getdate($value) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing getdate() : usage variation ***
+
+--String 0--
+array(11) {
+ ["seconds"]=>
+ int(0)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(0)
+}
+
+--String 10.5--
+array(11) {
+ ["seconds"]=>
+ int(10)
+ ["minutes"]=>
+ int(30)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(10)
+}
+
+--String -10.5--
+array(11) {
+ ["seconds"]=>
+ int(50)
+ ["minutes"]=>
+ int(29)
+ ["hours"]=>
+ int(5)
+ ["mday"]=>
+ int(1)
+ ["wday"]=>
+ int(4)
+ ["mon"]=>
+ int(1)
+ ["year"]=>
+ int(1970)
+ ["yday"]=>
+ int(0)
+ ["weekday"]=>
+ string(8) "Thursday"
+ ["month"]=>
+ string(7) "January"
+ [0]=>
+ int(-10)
+}
+===DONE===
diff --git a/ext/date/tests/getdate_variation7.phpt b/ext/date/tests/getdate_variation7.phpt
new file mode 100644
index 0000000..5af2dd5
--- /dev/null
+++ b/ext/date/tests/getdate_variation7.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test getdate() function : usage variation - Passing high positive and negative float values to timestamp.
+--FILE--
+<?php
+/* Prototype : array getdate([int timestamp])
+ * Description: Get date/time information
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getdate() : usage variation ***\n";
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( getdate($timestamp) );
+
+echo "\n-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( getdate($timestamp) );
+?>
+===DONE===
+--EXPECTREGEX--
+
+\*\*\* Testing getdate\(\) : usage variation \*\*\*
+
+-- Testing getdate\(\) function by passing float 12.3456789000e10 value to timestamp --
+array\(11\) {
+ \["seconds"\]=>
+ int\((36|0)\)
+ \["minutes"\]=>
+ int\((43|0)\)
+ \["hours"\]=>
+ int\((10|6)\)
+ \["mday"\]=>
+ int\((26|11)\)
+ \["wday"\]=>
+ int\((2|6)\)
+ \["mon"\]=>
+ int\(3\)
+ \["year"\]=>
+ int\((1935|5882)\)
+ \["yday"\]=>
+ int\((84|69)\)
+ \["weekday"\]=>
+ string\((7|8)\) "(Tuesday|Saturday)"
+ \["month"\]=>
+ string\(5\) "March"
+ \[0\]=>
+ int\((-1097262584|123456789000)\)
+}
+
+-- Testing getdate\(\) function by passing float -12.3456789000e10 value to timestamp --
+array\(11\) {
+ \["seconds"\]=>
+ int\((44|12|20)\)
+ \["minutes"\]=>
+ int\((39|23)\)
+ \["hours"\]=>
+ int\((0|2|5)\)
+ \["mday"\]=>
+ int\((9|14|23)\)
+ \["wday"\]=>
+ int\((6|-4)\)
+ \["mon"\]=>
+ int\((10|12)\)
+ \["year"\]=>
+ int\((2004|1901|-1943)\)
+ \["yday"\]=>
+ int\((282|347|295)\)
+ \["weekday"\]=>
+ string\((8|7)\) "(Saturday|Unknown)"
+ \["month"\]=>
+ string\((7|8)\) "(October|December)"
+ \[0\]=>
+ int\((1097262584|-2147483648|-123456789000)\)
+}
+===DONE===
diff --git a/ext/date/tests/gettimeofday_basic.phpt b/ext/date/tests/gettimeofday_basic.phpt
new file mode 100644
index 0000000..fe04f01
--- /dev/null
+++ b/ext/date/tests/gettimeofday_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gettimeofday() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array gettimeofday([bool get_as_float])
+ * Description: Returns the current time as array
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gettimeofday() : basic functionality ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+// Initialise all required variables
+$get_as_float = true;
+
+// Calling gettimeofday() with all possible arguments
+var_dump( gettimeofday($get_as_float) );
+
+// Calling gettimeofday() with mandatory arguments
+var_dump( gettimeofday() );
+
+// Initialise all required variables
+$get_as_float = false;
+
+// Calling gettimeofday() with all possible arguments
+var_dump( gettimeofday($get_as_float) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gettimeofday() : basic functionality ***
+float(%f)
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/gettimeofday_error.phpt b/ext/date/tests/gettimeofday_error.phpt
new file mode 100644
index 0000000..558a381
--- /dev/null
+++ b/ext/date/tests/gettimeofday_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test gettimeofday() function : error conditions
+--FILE--
+<?php
+/* Prototype : array gettimeofday([bool get_as_float])
+ * Description: Returns the current time as array
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gettimeofday() : error conditions ***\n";
+
+
+//Test gettimeofday with one more than the expected number of arguments
+echo "\n-- Testing gettimeofday() function with more than expected no. of arguments --\n";
+$get_as_float = true;
+$extra_arg = 10;
+var_dump( gettimeofday($get_as_float, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gettimeofday() : error conditions ***
+
+-- Testing gettimeofday() function with more than expected no. of arguments --
+
+Warning: gettimeofday() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/date/tests/gettimeofday_variation1.phpt b/ext/date/tests/gettimeofday_variation1.phpt
new file mode 100644
index 0000000..f494a25
--- /dev/null
+++ b/ext/date/tests/gettimeofday_variation1.phpt
@@ -0,0 +1,284 @@
+--TEST--
+Test gettimeofday() function : usage variation - Passing unexpected values to get_as_float argument
+--FILE--
+<?php
+/* Prototype : array gettimeofday([bool get_as_float])
+ * Description: Returns the current time as array
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gettimeofday() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for get_as_float
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gettimeofday($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gettimeofday() : usage variation ***
+
+--int 0--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--int 1--
+float(%f)
+
+--int 12345--
+float(%f)
+
+--int -12345--
+float(%f)
+
+--float 10.5--
+float(%f)
+
+--float -10.5--
+float(%f)
+
+--float 12.3456789000e10--
+float(%f)
+
+--float -12.3456789000e10--
+float(%f)
+
+--float .5--
+float(%f)
+
+--empty array--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, array given in %s on line %d
+NULL
+
+--int indexed array--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, array given in %s on line %d
+NULL
+
+--associative array--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, array given in %s on line %d
+NULL
+
+--nested arrays--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, array given in %s on line %d
+NULL
+
+--uppercase NULL--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--lowercase null--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--lowercase true--
+float(%f)
+
+--lowercase false--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--uppercase TRUE--
+float(%f)
+
+--uppercase FALSE--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--empty string DQ--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--empty string SQ--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--string DQ--
+float(%f)
+
+--string SQ--
+float(%f)
+
+--mixed case string--
+float(%f)
+
+--heredoc--
+float(%f)
+
+--instance of classWithToString--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, object given in %s on line %d
+NULL
+
+--instance of classWithoutToString--
+
+Warning: gettimeofday() expects parameter 1 to be boolean, object given in %s on line %d
+NULL
+
+--undefined var--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+
+--unset var--
+array(4) {
+ ["sec"]=>
+ int(%d)
+ ["usec"]=>
+ int(%d)
+ ["minuteswest"]=>
+ int(-330)
+ ["dsttime"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/gmdate_basic.phpt b/ext/date/tests/gmdate_basic.phpt
new file mode 100644
index 0000000..ae036ca
--- /dev/null
+++ b/ext/date/tests/gmdate_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test gmdate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : basic functionality ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+// Calling gmdate() with all possible arguments
+var_dump( gmdate($format, $timestamp) );
+
+// Calling gmdate() with mandatory arguments
+var_dump( gmdate($format) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : basic functionality ***
+string(24) "2008-08-08T08:08:08+0000"
+string(%d) "%s"
+===DONE===
diff --git a/ext/date/tests/gmdate_error.phpt b/ext/date/tests/gmdate_error.phpt
new file mode 100644
index 0000000..fbee071
--- /dev/null
+++ b/ext/date/tests/gmdate_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test gmdate() function : error conditions
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : error conditions ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+// Zero arguments
+echo "\n-- Testing gmdate() function with Zero arguments --\n";
+var_dump( gmdate() );
+
+//Test gmdate with one more than the expected number of arguments
+echo "\n-- Testing gmdate() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( gmdate($format, $timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : error conditions ***
+
+-- Testing gmdate() function with Zero arguments --
+
+Warning: gmdate() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing gmdate() function with more than expected no. of arguments --
+
+Warning: gmdate() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmdate_variation1.phpt b/ext/date/tests/gmdate_variation1.phpt
new file mode 100644
index 0000000..e2e2331
--- /dev/null
+++ b/ext/date/tests/gmdate_variation1.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test gmdate() function : usage variation - Passing unexpected values to format argument .
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value, $timestamp) );
+ var_dump( gmdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--int 0--
+string(1) "0"
+string(1) "0"
+
+--int 1--
+string(1) "1"
+string(1) "1"
+
+--int 12345--
+string(5) "12345"
+string(5) "12345"
+
+--int -12345--
+string(6) "-12345"
+string(6) "-12345"
+
+--float 10.5--
+string(4) "10.5"
+string(4) "10.5"
+
+--float -10.5--
+string(5) "-10.5"
+string(5) "-10.5"
+
+--float 12.3456789000e10--
+string(12) "123456789000"
+string(12) "123456789000"
+
+--float -12.3456789000e10--
+string(13) "-123456789000"
+string(13) "-123456789000"
+
+--float .5--
+string(3) "0.5"
+string(3) "0.5"
+
+--empty array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(0) ""
+string(0) ""
+
+--lowercase null--
+string(0) ""
+string(0) ""
+
+--lowercase true--
+string(1) "1"
+string(1) "1"
+
+--lowercase false--
+string(0) ""
+string(0) ""
+
+--uppercase TRUE--
+string(1) "1"
+string(1) "1"
+
+--uppercase FALSE--
+string(0) ""
+string(0) ""
+
+--empty string DQ--
+string(0) ""
+string(0) ""
+
+--empty string SQ--
+string(0) ""
+string(0) ""
+
+--instance of classWithToString--
+string(53) "CFridayam0808 AM 2008b8UTC2008-08-08T08:08:08+00:0031"
+string(%d) "%s"
+
+--instance of classWithoutToString--
+
+Warning: gmdate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: gmdate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(0) ""
+string(0) ""
+
+--unset var--
+string(0) ""
+string(0) ""
+===DONE===
diff --git a/ext/date/tests/gmdate_variation10.phpt b/ext/date/tests/gmdate_variation10.phpt
new file mode 100644
index 0000000..d529836
--- /dev/null
+++ b/ext/date/tests/gmdate_variation10.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Timezone format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('Asia/Calcutta');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with Timezone identifier format --\n";
+var_dump( gmdate('e') );
+var_dump( gmdate('e', $timestamp) );
+
+echo "\n-- Testing gmdate() function with checking whether date is in daylight saving time format --\n";
+var_dump( gmdate('I') );
+var_dump( gmdate('I', $timestamp) );
+
+echo "\n-- Testing gmdate() function with difference to GMT in hours format --\n";
+var_dump( gmdate('O') );
+var_dump( gmdate('O', $timestamp) );
+
+echo "\n-- Testing gmdate() function with Difference to GMT in hours using colon as separator format --\n";
+var_dump( gmdate('P') );
+var_dump( gmdate('P', $timestamp) );
+
+echo "\n-- Testing gmdate() function with timezone abbreviation format --\n";
+var_dump( gmdate('T') );
+var_dump( gmdate('T', $timestamp) );
+
+echo "\n-- Testing gmdate() function with timezone offset format --\n";
+var_dump( gmdate('T') );
+var_dump( gmdate('T', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with Timezone identifier format --
+string(3) "UTC"
+string(3) "UTC"
+
+-- Testing gmdate() function with checking whether date is in daylight saving time format --
+string(1) "%d"
+string(1) "%d"
+
+-- Testing gmdate() function with difference to GMT in hours format --
+string(5) "+0000"
+string(5) "+0000"
+
+-- Testing gmdate() function with Difference to GMT in hours using colon as separator format --
+string(6) "+00:00"
+string(6) "+00:00"
+
+-- Testing gmdate() function with timezone abbreviation format --
+string(3) "GMT"
+string(3) "GMT"
+
+-- Testing gmdate() function with timezone offset format --
+string(3) "GMT"
+string(3) "GMT"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation11.phpt b/ext/date/tests/gmdate_variation11.phpt
new file mode 100644
index 0000000..a952090
--- /dev/null
+++ b/ext/date/tests/gmdate_variation11.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Full Date/Time format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with ISO 8601 date format --\n";
+var_dump( gmdate('c') );
+var_dump( gmdate('c', $timestamp) );
+
+echo "\n-- Testing gmdate() function with RFC 2822 date format --\n";
+var_dump( gmdate('r') );
+var_dump( gmdate('r', $timestamp) );
+
+echo "\n-- Testing gmdate() function with seconds since Unix Epoch format --\n";
+var_dump( gmdate('U') );
+var_dump( gmdate('U', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with ISO 8601 date format --
+string(%d) "%s"
+string(25) "2008-08-08T08:08:08+00:00"
+
+-- Testing gmdate() function with RFC 2822 date format --
+string(%d) "%s"
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+
+-- Testing gmdate() function with seconds since Unix Epoch format --
+string(%d) "%d"
+string(10) "1218182888"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation12.phpt b/ext/date/tests/gmdate_variation12.phpt
new file mode 100644
index 0000000..8f0146f
--- /dev/null
+++ b/ext/date/tests/gmdate_variation12.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test gmdate() function : usage variation - Valid and invalid range of timestamp.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+
+$timestamp = mktime(20, 45, 54, 12, 13, 1901);
+echo "\n-- Testing gmdate() function with minimum range of timestamp --\n";
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+$timestamp = mktime(20, 45, 50, 12, 13, 1901);
+echo "\n-- Testing gmdate() function with less than the range of timestamp --\n";
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+echo "\n-- Testing gmdate() function with maximum range of timestamp --\n";
+$timestamp = mktime(03, 14, 07, 1, 19, 2038);
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+echo "\n-- Testing gmdate() function with greater than the range of timestamp --\n";
+$timestamp = mktime(03, 14, 10, 1, 19, 2038);
+var_dump( gmdate(DATE_ISO8601, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmdate\(\) : usage variation \*\*\*
+
+-- Testing gmdate\(\) function with minimum range of timestamp --
+string\(24\) "1901-12-13T20:45:54\+0000"
+
+-- Testing gmdate\(\) function with less than the range of timestamp --
+string\(24\) "(1970-01-01T00:00:00\+0000|1901-12-13T20:45:50\+0000)"
+
+-- Testing gmdate\(\) function with maximum range of timestamp --
+string\(24\) "2038-01-19T03:14:07\+0000"
+
+-- Testing gmdate\(\) function with greater than the range of timestamp --
+string\(24\) "(1970-01-01T00:00:00\+0000|2038-01-19T03:14:10\+0000)"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation13.phpt b/ext/date/tests/gmdate_variation13.phpt
new file mode 100644
index 0000000..5a19ae2
--- /dev/null
+++ b/ext/date/tests/gmdate_variation13.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test gmdate() function : usage variation - Passing predefined constants to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ // Predefined Date constants
+ 'DATE_ATOM Constant' => DATE_ATOM,
+ 'DATE_COOKIE Constant' => DATE_COOKIE,
+ 'DATE_RFC822 Constant' => DATE_RFC822,
+ 'DATE_RFC850 Constant' => DATE_RFC850,
+ 'DATE_RFC1036 Constant' => DATE_RFC1036,
+ 'DATE_RFC1123 Constant' => DATE_RFC1123,
+ 'DATE_RFC2822 Constant' => DATE_RFC2822,
+ 'DATE_RFC3339 Constant' => DATE_RFC3339,
+ 'DATE_RSS Constant' => DATE_RSS,
+ 'DATE_W3C Constant' => DATE_W3C,
+);
+
+// loop through each element of the array for format
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value, $timestamp) );
+ var_dump( gmdate($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--DATE_ATOM Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+
+--DATE_COOKIE Constant--
+string(30) "Friday, 08-Aug-08 08:08:08 GMT"
+string(%d) "%s"
+
+--DATE_RFC822 Constant--
+string(29) "Fri, 08 Aug 08 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC850 Constant--
+string(30) "Friday, 08-Aug-08 08:08:08 GMT"
+string(%d) "%s"
+
+--DATE_RFC1036 Constant--
+string(29) "Fri, 08 Aug 08 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC1123 Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC2822 Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_RFC3339 Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+
+--DATE_RSS Constant--
+string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
+string(%d) "%s"
+
+--DATE_W3C Constant--
+string(25) "2008-08-08T08:08:08+00:00"
+string(%d) "%s"
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt
new file mode 100644
index 0000000..5b62a82
--- /dev/null
+++ b/ext/date/tests/gmdate_variation14.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test gmdate() function : usage variation - Passing high positive and negetive float values to timestamp.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+
+echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( gmdate($format, $timestamp) );
+
+echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( gmdate($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmdate\(\) : usage variation \*\*\*
+
+-- Testing gmdate\(\) function with float 12.3456789000e10 to timestamp --
+string\((24|25)\) "(1935-03-26T04:50:16\+0000|5882-03-11T00:30:00\+0000)"
+
+-- Testing gmdate\(\) function with float -12.3456789000e10 to timestamp --
+string\((24|25)\) "(2004-10-08T19:09:44\+0000|1901-12-13T20:45:52\+0000|-1943-10-22T23:30:00\+0000)"
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/gmdate_variation2.phpt b/ext/date/tests/gmdate_variation2.phpt
new file mode 100644
index 0000000..c52de9d
--- /dev/null
+++ b/ext/date/tests/gmdate_variation2.phpt
@@ -0,0 +1,210 @@
+--TEST--
+Test gmdate() function : usage variation - Passing unexpected values to timestamp argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$format = DATE_ISO8601;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--int 0--
+string(24) "1970-01-01T00:00:00+0000"
+
+--int 1--
+string(24) "1970-01-01T00:00:01+0000"
+
+--int 12345--
+string(24) "1970-01-01T03:25:45+0000"
+
+--int -12345--
+string(24) "1969-12-31T20:34:15+0000"
+
+--float 10.5--
+string(24) "1970-01-01T00:00:10+0000"
+
+--float -10.5--
+string(24) "1969-12-31T23:59:50+0000"
+
+--float .5--
+string(24) "1970-01-01T00:00:00+0000"
+
+--empty array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmdate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(24) "1970-01-01T00:00:00+0000"
+
+--lowercase null--
+string(24) "1970-01-01T00:00:00+0000"
+
+--lowercase true--
+string(24) "1970-01-01T00:00:01+0000"
+
+--lowercase false--
+string(24) "1970-01-01T00:00:00+0000"
+
+--uppercase TRUE--
+string(24) "1970-01-01T00:00:01+0000"
+
+--uppercase FALSE--
+string(24) "1970-01-01T00:00:00+0000"
+
+--empty string DQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmdate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmdate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmdate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(24) "1970-01-01T00:00:00+0000"
+
+--unset var--
+string(24) "1970-01-01T00:00:00+0000"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation3.phpt b/ext/date/tests/gmdate_variation3.phpt
new file mode 100644
index 0000000..a93d6e9
--- /dev/null
+++ b/ext/date/tests/gmdate_variation3.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test gmdate() function : usage variation - Passing numeric representation of day formats.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Day with leading zeros' => 'd',
+ 'Day without leading zeros' => 'j',
+ 'ISO representation' => 'N',
+ 'Numeric representation of day' => 'w',
+ 'Day of the year' => 'z'
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value) );
+ var_dump( gmdate($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--Day with leading zeros--
+string(%d) "%d"
+string(2) "08"
+
+--Day without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--ISO representation--
+string(%d) "%d"
+string(1) "5"
+
+--Numeric representation of day--
+string(%d) "%d"
+string(1) "5"
+
+--Day of the year--
+string(%d) "%d"
+string(3) "220"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation4.phpt b/ext/date/tests/gmdate_variation4.phpt
new file mode 100644
index 0000000..bb97b56
--- /dev/null
+++ b/ext/date/tests/gmdate_variation4.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test gmdate() function : usage variation - Passing textual representation of day formats.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with partial textual representation of day --\n";
+var_dump( gmdate('D') );
+var_dump( gmdate('D', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full textual representation of day --\n";
+var_dump( gmdate('l') );
+var_dump( gmdate('l', $timestamp) );
+
+echo "\n-- Testing gmdate() function with English ordinal suffix --\n";
+var_dump( gmdate('S') );
+var_dump( gmdate('S', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with partial textual representation of day --
+string(%d) "%s"
+string(3) "Fri"
+
+-- Testing gmdate() function with full textual representation of day --
+string(%d) "%s"
+string(6) "Friday"
+
+-- Testing gmdate() function with English ordinal suffix --
+string(%d) "%s"
+string(2) "th"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation5.phpt b/ext/date/tests/gmdate_variation5.phpt
new file mode 100644
index 0000000..d40488a
--- /dev/null
+++ b/ext/date/tests/gmdate_variation5.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Week representation to format.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with ISO-8601 week number of year format --\n";
+var_dump( gmdate('W') );
+var_dump( gmdate('W', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with ISO-8601 week number of year format --
+string(%d) "%d"
+string(2) "32"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation6.phpt b/ext/date/tests/gmdate_variation6.phpt
new file mode 100644
index 0000000..f5b63a5
--- /dev/null
+++ b/ext/date/tests/gmdate_variation6.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Month format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing gmdate() function with full textual representation of month format --\n";
+var_dump( gmdate('F') );
+var_dump( gmdate('F', $timestamp) );
+
+echo "\n-- Testing gmdate() function with numeric representation of month format --\n";
+var_dump( gmdate('m') );
+var_dump( gmdate('m', $timestamp) );
+
+echo "\n-- Testing gmdate() function with short textual representation of month format --\n";
+var_dump( gmdate('M') );
+var_dump( gmdate('M', $timestamp) );
+
+echo "\n-- Testing gmdate() function with numeric representation of month without leading zeros format --\n";
+var_dump( gmdate('n') );
+var_dump( gmdate('n', $timestamp) );
+
+echo "\n-- Testing gmdate() function with number of days in a month format --\n";
+var_dump( gmdate('t') );
+var_dump( gmdate('t', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with full textual representation of month format --
+string(%d) "%s"
+string(6) "August"
+
+-- Testing gmdate() function with numeric representation of month format --
+string(%d) "%d"
+string(2) "08"
+
+-- Testing gmdate() function with short textual representation of month format --
+string(%d) "%s"
+string(3) "Aug"
+
+-- Testing gmdate() function with numeric representation of month without leading zeros format --
+string(%d) "%d"
+string(1) "8"
+
+-- Testing gmdate() function with number of days in a month format --
+string(%d) "%d"
+string(2) "31"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation7.phpt b/ext/date/tests/gmdate_variation7.phpt
new file mode 100644
index 0000000..8d9c1b0
--- /dev/null
+++ b/ext/date/tests/gmdate_variation7.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Year format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);
+
+echo "\n-- Testing gmdate() function with checking non leap year using Leap Year format --\n";
+var_dump( gmdate('L', $timestamp_non_leap_year) );
+
+echo "\n-- Testing gmdate() function with checking leap year using Leap Year format --\n";
+var_dump( gmdate('L') );
+var_dump( gmdate('L', $timestamp) );
+
+echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
+var_dump( gmdate('o') );
+var_dump( gmdate('o', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full numeric representation of year format --\n";
+var_dump( gmdate('Y') );
+var_dump( gmdate('Y', $timestamp) );
+
+echo "\n-- Testing gmdate() function with 2 digit representation year format --\n";
+var_dump( gmdate('y') );
+var_dump( gmdate('y', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with checking non leap year using Leap Year format --
+string(1) "0"
+
+-- Testing gmdate() function with checking leap year using Leap Year format --
+string(1) "%d"
+string(1) "1"
+
+-- Testing gmdate() function with ISO-8601 year number format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with full numeric representation of year format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with 2 digit representation year format --
+string(2) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation8.phpt b/ext/date/tests/gmdate_variation8.phpt
new file mode 100644
index 0000000..8d9c1b0
--- /dev/null
+++ b/ext/date/tests/gmdate_variation8.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Year format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$timestamp_non_leap_year = mktime(8, 8, 8, 8, 8, 2007);
+
+echo "\n-- Testing gmdate() function with checking non leap year using Leap Year format --\n";
+var_dump( gmdate('L', $timestamp_non_leap_year) );
+
+echo "\n-- Testing gmdate() function with checking leap year using Leap Year format --\n";
+var_dump( gmdate('L') );
+var_dump( gmdate('L', $timestamp) );
+
+echo "\n-- Testing gmdate() function with ISO-8601 year number format --\n";
+var_dump( gmdate('o') );
+var_dump( gmdate('o', $timestamp) );
+
+echo "\n-- Testing gmdate() function with full numeric representation of year format --\n";
+var_dump( gmdate('Y') );
+var_dump( gmdate('Y', $timestamp) );
+
+echo "\n-- Testing gmdate() function with 2 digit representation year format --\n";
+var_dump( gmdate('y') );
+var_dump( gmdate('y', $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+-- Testing gmdate() function with checking non leap year using Leap Year format --
+string(1) "0"
+
+-- Testing gmdate() function with checking leap year using Leap Year format --
+string(1) "%d"
+string(1) "1"
+
+-- Testing gmdate() function with ISO-8601 year number format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with full numeric representation of year format --
+string(4) "%d"
+string(4) "2008"
+
+-- Testing gmdate() function with 2 digit representation year format --
+string(2) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmdate_variation9.phpt b/ext/date/tests/gmdate_variation9.phpt
new file mode 100644
index 0000000..e210557
--- /dev/null
+++ b/ext/date/tests/gmdate_variation9.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test gmdate() function : usage variation - Passing Time format options to format argument.
+--FILE--
+<?php
+/* Prototype : string gmdate(string format [, long timestamp])
+ * Description: Format a GMT date/time
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmdate() : usage variation ***\n";
+
+// Initialise all required variables
+date_default_timezone_set('UTC');
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+$time_formats = array(
+
+ 'Lowercase Ante meridiem and post meridiem' => 'a',
+ 'Uppercase Ante meridiem and post meridiem' => 'a',
+ 'Swatch Internet time' => 'B',
+ '12-hour format without leading zeros' => 'g',
+ '24-hour format without leading zeros' => 'G',
+ '12-hour format with leading zeros' => 'h',
+ '24-hour format with leading zeros' => 'H',
+ 'Minutes with leading zeros' => 'i',
+ 'Seconds with leading zeros' => 's',
+ 'Milliseconds' => 'u',
+);
+
+foreach($time_formats as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmdate($value) );
+ var_dump( gmdate($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmdate() : usage variation ***
+
+--Lowercase Ante meridiem and post meridiem--
+string(2) "%s"
+string(2) "am"
+
+--Uppercase Ante meridiem and post meridiem--
+string(2) "%s"
+string(2) "am"
+
+--Swatch Internet time--
+string(%d) "%d"
+string(3) "380"
+
+--12-hour format without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--24-hour format without leading zeros--
+string(%d) "%d"
+string(1) "8"
+
+--12-hour format with leading zeros--
+string(%d) "%d"
+string(2) "08"
+
+--24-hour format with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Minutes with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Seconds with leading zeros--
+string(2) "%d"
+string(2) "08"
+
+--Milliseconds--
+string(%d) "%d"
+string(6) "000000"
+===DONE===
diff --git a/ext/date/tests/gmmktime_basic.phpt b/ext/date/tests/gmmktime_basic.phpt
new file mode 100644
index 0000000..81abb5f
--- /dev/null
+++ b/ext/date/tests/gmmktime_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test gmmktime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : basic functionality ***\n";
+
+// Initialise all required variables
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+// Calling gmmktime() with all possible arguments
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
+
+// Calling gmmktime() with mandatory arguments
+var_dump( gmmktime() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : basic functionality ***
+int(1218182888)
+
+Strict Standards: gmmktime(): You should be using the time() function instead in %s on line %d
+int(%d)
+===DONE===
diff --git a/ext/date/tests/gmmktime_error.phpt b/ext/date/tests/gmmktime_error.phpt
new file mode 100644
index 0000000..9f5882d
--- /dev/null
+++ b/ext/date/tests/gmmktime_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test gmmktime() function : error conditions
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : error conditions ***\n";
+
+//Test gmmktime with one more than the expected number of arguments
+echo "\n-- Testing gmmktime() function with more than expected no. of arguments --\n";
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+$extra_arg1 = 10;
+$extra_arg2 = 10;
+
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year, $extra_arg1) );
+
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year, $extra_arg1, $extra_arg2) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : error conditions ***
+
+-- Testing gmmktime() function with more than expected no. of arguments --
+
+Deprecated: gmmktime(): The is_dst parameter is deprecated in %s on line %d
+int(1218182888)
+
+Warning: gmmktime() expects at most 7 parameters, 8 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation1.phpt b/ext/date/tests/gmmktime_variation1.phpt
new file mode 100644
index 0000000..f84d99b
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation1.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to first argument hour.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for hour
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1218190088)
+
+--float -10.5--
+int(1218118088)
+
+--float .5--
+int(1218154088)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218154088)
+
+--lowercase null--
+int(1218154088)
+
+--lowercase true--
+int(1218157688)
+
+--lowercase false--
+int(1218154088)
+
+--uppercase TRUE--
+int(1218157688)
+
+--uppercase FALSE--
+int(1218154088)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218154088)
+
+--unset var--
+int(1218154088)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation2.phpt b/ext/date/tests/gmmktime_variation2.phpt
new file mode 100644
index 0000000..93b87f6
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation2.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to second argument minute.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for min
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1218183008)
+
+--float -10.5--
+int(1218181808)
+
+--float .5--
+int(1218182408)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218182408)
+
+--lowercase null--
+int(1218182408)
+
+--lowercase true--
+int(1218182468)
+
+--lowercase false--
+int(1218182408)
+
+--uppercase TRUE--
+int(1218182468)
+
+--uppercase FALSE--
+int(1218182408)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218182408)
+
+--unset var--
+int(1218182408)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation3.phpt b/ext/date/tests/gmmktime_variation3.phpt
new file mode 100644
index 0000000..d180e82
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation3.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to third argument seconds.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$min = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for sec
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1218182890)
+
+--float -10.5--
+int(1218182870)
+
+--float .5--
+int(1218182880)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1218182880)
+
+--lowercase null--
+int(1218182880)
+
+--lowercase true--
+int(1218182881)
+
+--lowercase false--
+int(1218182880)
+
+--uppercase TRUE--
+int(1218182881)
+
+--uppercase FALSE--
+int(1218182880)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1218182880)
+
+--unset var--
+int(1218182880)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation4.phpt b/ext/date/tests/gmmktime_variation4.phpt
new file mode 100644
index 0000000..9093119
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation4.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to fourth argument month.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$min = 8;
+$sec = 8;
+$day = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for mon
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1223453288)
+
+--float -10.5--
+int(1170922088)
+
+--float .5--
+int(1197101288)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1197101288)
+
+--lowercase null--
+int(1197101288)
+
+--lowercase true--
+int(1199779688)
+
+--lowercase false--
+int(1197101288)
+
+--uppercase TRUE--
+int(1199779688)
+
+--uppercase FALSE--
+int(1197101288)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1197101288)
+
+--unset var--
+int(1197101288)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation5.phpt b/ext/date/tests/gmmktime_variation5.phpt
new file mode 100644
index 0000000..dd1ca3e
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation5.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to fifth argument day.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$year = 2008;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for day
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $min, $sec, $mon, $value, $year) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1218355688)
+
+--float -10.5--
+int(1216627688)
+
+--float .5--
+int(1217491688)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1217491688)
+
+--lowercase null--
+int(1217491688)
+
+--lowercase true--
+int(1217578088)
+
+--lowercase false--
+int(1217491688)
+
+--uppercase TRUE--
+int(1217578088)
+
+--uppercase FALSE--
+int(1217491688)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 5 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 5 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1217491688)
+
+--unset var--
+int(1217491688)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation6.phpt b/ext/date/tests/gmmktime_variation6.phpt
new file mode 100644
index 0000000..4877556
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation6.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing unexpected values to sixth argument year.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for year
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($hour, $min, $sec, $mon, $day, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+--float 10.5--
+int(1281254888)
+
+--float .5--
+int(965722088)
+
+--empty array--
+
+Warning: gmmktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmmktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmmktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmmktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(965722088)
+
+--lowercase null--
+int(965722088)
+
+--lowercase true--
+int(997258088)
+
+--lowercase false--
+int(965722088)
+
+--uppercase TRUE--
+int(997258088)
+
+--uppercase FALSE--
+int(965722088)
+
+--empty string DQ--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmmktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmmktime() expects parameter 6 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmmktime() expects parameter 6 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(965722088)
+
+--unset var--
+int(965722088)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation7.phpt b/ext/date/tests/gmmktime_variation7.phpt
new file mode 100644
index 0000000..3d0d25a
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation7.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test gmmktime() function : usage variation - Checking with few optional arguments.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise all required variables
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+
+echo "\n-- Testing gmmktime() function with one optional argument --\n";
+var_dump( gmmktime($hour) );
+
+echo "\n-- Testing gmmktime() function with two optional argument --\n";
+var_dump( gmmktime($hour, $min) );
+
+echo "\n-- Testing gmmktime() function with three optional argument --\n";
+var_dump( gmmktime($hour, $min, $sec) );
+
+echo "\n-- Testing gmmktime() function with four optional argument --\n";
+var_dump( gmmktime($hour, $min, $sec, $mon) );
+
+echo "\n-- Testing gmmktime() function with five optional argument --\n";
+var_dump( gmmktime($hour, $min, $sec, $mon, $day) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+-- Testing gmmktime() function with one optional argument --
+int(%d)
+
+-- Testing gmmktime() function with two optional argument --
+int(%d)
+
+-- Testing gmmktime() function with three optional argument --
+int(%d)
+
+-- Testing gmmktime() function with four optional argument --
+int(%d)
+
+-- Testing gmmktime() function with five optional argument --
+int(%d)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation8.phpt b/ext/date/tests/gmmktime_variation8.phpt
new file mode 100644
index 0000000..b0c56a1
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation8.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing octal and hexadecimal values to arguments.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+// Initialise all required variables
+$hour = 010;
+$min = 010;
+$sec = 010;
+$mon = 010;
+$day = 010;
+$year = 03730;
+
+echo "\n-- Testing gmmktime() function with supplying octal values to arguments --\n";
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
+
+// Initialise all required variables
+$hour = 0x8;
+$min = 0x8;
+$sec = 0x8;
+$mon = 0x8;
+$day = 0x8;
+$year = 0x7D8;
+
+echo "\n-- Testing gmmktime() function with supplying hexa decimal values to arguments --\n";
+var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmmktime() : usage variation ***
+
+-- Testing gmmktime() function with supplying octal values to arguments --
+int(1218182888)
+
+-- Testing gmmktime() function with supplying hexa decimal values to arguments --
+int(1218182888)
+===DONE===
diff --git a/ext/date/tests/gmmktime_variation9.phpt b/ext/date/tests/gmmktime_variation9.phpt
new file mode 100644
index 0000000..fa463e0
--- /dev/null
+++ b/ext/date/tests/gmmktime_variation9.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test gmmktime() function : usage variation - Passing positive and negative float values to arguments.
+--FILE--
+<?php
+/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+ * Description: Get UNIX timestamp for a GMT date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmmktime() : usage variation ***\n";
+
+//Initialise variables
+$hour = 8;
+$min = 8;
+$sec = 8;
+$mon = 8;
+$day = 8;
+$year = 2008;
+
+$inputs = array(
+
+ 'float 123456' => 123456,
+ 'float -123456' => -123456,
+ 'float -10.5' => -10.5,
+);
+
+// loop through each element of the array for min
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) );
+ var_dump( gmmktime($hour, $min, $sec, $mon, $value, $value) );
+}
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmmktime\(\) : usage variation \*\*\*
+
+--float 123456--
+int\(1662595688\)
+int\(1225589768\)
+int\(1218306336\)
+(bool|int)\((false|325855037288)\)
+(bool|int)\((false|3844412784488)\)
+
+--float -123456--
+int\(773712488\)
+int\(1210775048\)
+int\(1218059424\)
+(bool|int)\((false|-323460834712)\)
+(bool|int)\((false|-3968710530712)\)
+
+--float -10.5--
+int\(1218118088\)
+int\(1218181808\)
+int\(1218182870\)
+int\(1170922088\)
+(bool|int)\((false|-62465356312)\)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_basic.phpt b/ext/date/tests/gmstrftime_basic.phpt
new file mode 100644
index 0000000..17bad69
--- /dev/null
+++ b/ext/date/tests/gmstrftime_basic.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test gmstrftime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : basic functionality ***\n";
+
+// Initialise all required variables
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+
+// Calling gmstrftime() with all possible arguments
+var_dump( gmstrftime($format, $timestamp) );
+
+// Calling gmstrftime() with mandatory arguments
+var_dump( gmstrftime($format) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : basic functionality ***
+string(20) "Aug 08 2008 08:08:08"
+string(%d) "%s %d %d %d:%d:%d"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_error.phpt b/ext/date/tests/gmstrftime_error.phpt
new file mode 100644
index 0000000..d28780f
--- /dev/null
+++ b/ext/date/tests/gmstrftime_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test gmstrftime() function : error conditions
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing gmstrftime() function with Zero arguments --\n";
+var_dump( gmstrftime() );
+
+//Test gmstrftime with one more than the expected number of arguments
+echo "\n-- Testing gmstrftime() function with more than expected no. of arguments --\n";
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+$extra_arg = 10;
+var_dump( gmstrftime($format, $timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : error conditions ***
+
+-- Testing gmstrftime() function with Zero arguments --
+
+Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing gmstrftime() function with more than expected no. of arguments --
+
+Warning: gmstrftime() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation1.phpt b/ext/date/tests/gmstrftime_variation1.phpt
new file mode 100644
index 0000000..d123fb2
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation1.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing unexpected values to first argument 'format'.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--int 0--
+string(1) "0"
+string(1) "0"
+
+--int 1--
+string(1) "1"
+string(1) "1"
+
+--int 12345--
+string(5) "12345"
+string(5) "12345"
+
+--int -12345--
+string(6) "-12345"
+string(6) "-12345"
+
+--float 10.5--
+string(4) "10.5"
+string(4) "10.5"
+
+--float -10.5--
+string(5) "-10.5"
+string(5) "-10.5"
+
+--float 12.3456789000e10--
+string(12) "123456789000"
+string(12) "123456789000"
+
+--float -12.3456789000e10--
+string(13) "-123456789000"
+string(13) "-123456789000"
+
+--float .5--
+string(3) "0.5"
+string(3) "0.5"
+
+--empty array--
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+bool(false)
+bool(false)
+
+--lowercase null--
+bool(false)
+bool(false)
+
+--lowercase true--
+string(1) "1"
+string(1) "1"
+
+--lowercase false--
+bool(false)
+bool(false)
+
+--uppercase TRUE--
+string(1) "1"
+string(1) "1"
+
+--uppercase FALSE--
+bool(false)
+bool(false)
+
+--empty string DQ--
+bool(false)
+bool(false)
+
+--empty string SQ--
+bool(false)
+bool(false)
+
+--instance of classWithToString--
+string(14) "Class A object"
+string(14) "Class A object"
+
+--instance of classWithoutToString--
+
+Warning: gmstrftime() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: gmstrftime() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+bool(false)
+bool(false)
+
+--unset var--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation10.phpt b/ext/date/tests/gmstrftime_variation10.phpt
new file mode 100644
index 0000000..0e54d84
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation10.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking week related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--The ISO 8601:1988 week number--
+string(%d) "%d"
+string(2) "32"
+
+--Weekday as decimal--
+string(%d) "%d"
+string(1) "5"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation11.phpt b/ext/date/tests/gmstrftime_variation11.phpt
new file mode 100644
index 0000000..482ff6d
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation11.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking month related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing gmstrftime() function with Abbreviated month name format %h --\n";
+$format = "%h";
+var_dump( gmstrftime($format) );
+var_dump( gmstrftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+-- Testing gmstrftime() function with Abbreviated month name format %h --
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation12.phpt b/ext/date/tests/gmstrftime_variation12.phpt
new file mode 100644
index 0000000..2c25af6
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation12.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking month related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing gmstrftime() function with Abbreviated month name format %h --\n";
+$format = "%h";
+var_dump( gmstrftime($format) );
+var_dump( gmstrftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+-- Testing gmstrftime() function with Abbreviated month name format %h --
+string(%d) "%s"
+string(3) "Aug"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation13.phpt b/ext/date/tests/gmstrftime_variation13.phpt
new file mode 100644
index 0000000..42f33f0
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation13.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking date related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Century number--
+bool(false)
+bool(false)
+
+--Month Date Year--
+bool(false)
+bool(false)
+
+--Year with century--
+bool(false)
+bool(false)
+
+--Year without century--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation14.phpt b/ext/date/tests/gmstrftime_variation14.phpt
new file mode 100644
index 0000000..880b433
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation14.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking date related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Century number--
+string(%d) "%d"
+string(2) "20"
+
+--Month Date Year--
+string(%d) "%d/%d/%d"
+string(8) "08/08/08"
+
+--Year with century--
+string(%d) "%d"
+string(4) "2008"
+
+--Year without century--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation15.phpt b/ext/date/tests/gmstrftime_variation15.phpt
new file mode 100644
index 0000000..c0df364
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation15.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking time related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Time in a.m/p.m notation--
+bool(false)
+bool(false)
+
+--Time in 24 hour notation--
+bool(false)
+bool(false)
+
+--Current time %H:%M:%S format--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation16.phpt b/ext/date/tests/gmstrftime_variation16.phpt
new file mode 100644
index 0000000..fd9f809
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation16.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking time related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(14, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Time in a.m/p.m notation--
+string(%d) "%d:%d:%d %s"
+string(11) "02:08:08 PM"
+
+--Time in 24 hour notation--
+string(%d) "%d:%d"
+string(5) "14:08"
+
+--Current time %H:%M:%S format--
+string(%d) "%d:%d:%d"
+string(8) "14:08:08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation17.phpt b/ext/date/tests/gmstrftime_variation17.phpt
new file mode 100644
index 0000000..e3070a5
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation17.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking day related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing gmstrftime() function with Day of the month as decimal single digit format --\n";
+$format = "%e";
+var_dump( gmstrftime($format) );
+var_dump( gmstrftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+-- Testing gmstrftime() function with Day of the month as decimal single digit format --
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation18.phpt b/ext/date/tests/gmstrftime_variation18.phpt
new file mode 100644
index 0000000..7cd5948
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation18.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking day related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing gmstrftime() function with Day of the month as decimal single digit format --\n";
+$format = "%e";
+var_dump( gmstrftime($format) );
+var_dump( gmstrftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+-- Testing gmstrftime() function with Day of the month as decimal single digit format --
+string(%d) "%s"
+string(2) " 8"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation19.phpt b/ext/date/tests/gmstrftime_variation19.phpt
new file mode 100644
index 0000000..3131e01
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation19.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking newline and tab formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Newline character--
+bool(false)
+bool(false)
+
+--Tab character--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation2.phpt b/ext/date/tests/gmstrftime_variation2.phpt
new file mode 100644
index 0000000..c577fe1
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation2.phpt
@@ -0,0 +1,206 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing unexpected values to second argument 'timestamp'.
+--SKIPIF--
+<?php
+if(PHP_INT_SIZE != 4 ) {
+ die("skip Test is not valid for 64-bit");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+// Initialise function arguments not being substituted (if any)
+$format = '%b %d %Y %H:%M:%S';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--float 10.5--
+string(20) "Jan 01 1970 00:00:10"
+
+--float -10.5--
+string(20) "Dec 31 1969 23:59:50"
+
+--float 12.3456789000e10--
+string(20) "Mar 26 1935 04:50:16"
+
+--float -12.3456789000e10--
+string(20) "Oct 08 2004 19:09:44"
+
+--float .5--
+string(20) "Jan 01 1970 00:00:00"
+
+--empty array--
+
+Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: gmstrftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(20) "Jan 01 1970 00:00:00"
+
+--lowercase null--
+string(20) "Jan 01 1970 00:00:00"
+
+--lowercase true--
+string(20) "Jan 01 1970 00:00:01"
+
+--lowercase false--
+string(20) "Jan 01 1970 00:00:00"
+
+--uppercase TRUE--
+string(20) "Jan 01 1970 00:00:01"
+
+--uppercase FALSE--
+string(20) "Jan 01 1970 00:00:00"
+
+--empty string DQ--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: gmstrftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: gmstrftime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: gmstrftime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(20) "Jan 01 1970 00:00:00"
+
+--unset var--
+string(20) "Jan 01 1970 00:00:00"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation20.phpt b/ext/date/tests/gmstrftime_variation20.phpt
new file mode 100644
index 0000000..a8898d8
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation20.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking newline and tab formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing gmstrftime\(\) : usage variation \*\*\*
+
+--Newline character--
+string\(1\) "
+"
+string\(1\) "
+"
+
+--Tab character--
+string\(1\) "\s"
+string\(1\) "\s"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation21.phpt b/ext/date/tests/gmstrftime_variation21.phpt
new file mode 100644
index 0000000..26ed157
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation21.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking Preferred date and time representation on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Preferred date and time representation' => "%c",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Preferred date and time representation--
+string(%d) "%d/%d/%d %d:%d:%d"
+string(17) "08/08/08 08:08:08"
+
+--Preferred date representation--
+string(%d) "%d/%d/%d"
+string(8) "08/08/08"
+
+--Preferred time representation--
+string(%d) "%d:%d:%d"
+string(8) "08:08:08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation22.phpt b/ext/date/tests/gmstrftime_variation22.phpt
new file mode 100644
index 0000000..d9abdce
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation22.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking Preferred date and time representation other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+if (!setlocale(LC_TIME, "POSIX")) {
+ die("skip Locale POSIX is required to run this test");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_TIME, "POSIX");
+putenv("LC_TIME=POSIX");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Preferred date and time representation' => "%c",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( $value );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECT--
+*** Testing gmstrftime() : usage variation ***
+
+--Preferred date and time representation--
+string(2) "%c"
+string(24) "Fri Aug 8 08:08:08 2008"
+
+--Preferred date representation--
+string(2) "%x"
+string(8) "08/08/08"
+
+--Preferred time representation--
+string(2) "%X"
+string(8) "08:08:08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation3.phpt b/ext/date/tests/gmstrftime_variation3.phpt
new file mode 100644
index 0000000..bc05c7b
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation3.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing week related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Abbreviated weekday name' => "%a",
+ 'Full weekday name' => "%A",
+ 'Week number of the year' => "%U",
+ 'Week number of the year in decimal number' => "%W",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Abbreviated weekday name--
+string(%d) "%s"
+string(3) "Fri"
+
+--Full weekday name--
+string(%d) "%s"
+string(6) "Friday"
+
+--Week number of the year--
+string(%d) "%d"
+string(2) "31"
+
+--Week number of the year in decimal number--
+string(%d) "%d"
+string(2) "31"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation4.phpt b/ext/date/tests/gmstrftime_variation4.phpt
new file mode 100644
index 0000000..619e633
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation4.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing month related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Abbreviated month name' => "%b",
+ 'Full month name' => "%B",
+ 'Month as decimal' => "%m",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Abbreviated month name--
+string(%d) "%s"
+string(3) "Aug"
+
+--Full month name--
+string(%d) "%s"
+string(6) "August"
+
+--Month as decimal--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation5.phpt b/ext/date/tests/gmstrftime_variation5.phpt
new file mode 100644
index 0000000..95e3bd2
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation5.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing date related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+
+//array of values to iterate over
+$inputs = array(
+ 'Year as decimal number without a century' => "%y",
+ 'Year as decimal number including the century' => "%Y",
+ 'Time zone offset' => "%Z",
+ 'Time zone offset' => "%z",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Year as decimal number without a century--
+string(%d) "%d"
+string(2) "08"
+
+--Year as decimal number including the century--
+string(%d) "%d"
+string(4) "2008"
+
+--Time zone offset--
+string(%s) "%s"
+string(%s) "%s"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation6.phpt b/ext/date/tests/gmstrftime_variation6.phpt
new file mode 100644
index 0000000..92dd1ed
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation6.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing time related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Hour as decimal by 24-hour format' => "%H",
+ 'Hour as decimal by 12-hour format' => "%I",
+ 'Minute as decimal number' => "%M",
+ 'AM/PM format for a time' => "%p",
+ 'Second as decimal number' => "%S",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Hour as decimal by 24-hour format--
+string(2) "%d"
+string(2) "08"
+
+--Hour as decimal by 12-hour format--
+string(2) "%d"
+string(2) "08"
+
+--Minute as decimal number--
+string(%d) "%d"
+string(2) "08"
+
+--AM/PM format for a time--
+string(2) "%s"
+string(2) "AM"
+
+--Second as decimal number--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation7.phpt b/ext/date/tests/gmstrftime_variation7.phpt
new file mode 100644
index 0000000..dd0584b
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation7.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing day related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'Day of the month as a decimal number' => "%d",
+ 'Day of the year as a decimal number' => "%j",
+ 'Day of the week as a decimal number' => "%w"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--Day of the month as a decimal number--
+string(%d) "%d"
+string(2) "08"
+
+--Day of the year as a decimal number--
+string(%d) "%d"
+string(3) "221"
+
+--Day of the week as a decimal number--
+string(%d) "%d"
+string(1) "5"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation8.phpt b/ext/date/tests/gmstrftime_variation8.phpt
new file mode 100644
index 0000000..59057aa
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation8.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test gmstrftime() function : usage variation - Passing literal related strings to format argument.
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'A literal % character' => "%%",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--A literal % character--
+string(1) "%"
+string(1) "%"
+===DONE===
diff --git a/ext/date/tests/gmstrftime_variation9.phpt b/ext/date/tests/gmstrftime_variation9.phpt
new file mode 100644
index 0000000..95b6c90
--- /dev/null
+++ b/ext/date/tests/gmstrftime_variation9.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test gmstrftime() function : usage variation - Checking week related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gmstrftime(string format [, int timestamp])
+ * Description: Format a GMT/UCT time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gmstrftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gmstrftime($value) );
+ var_dump( gmstrftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gmstrftime() : usage variation ***
+
+--The ISO 8601:1988 week number--
+bool(false)
+bool(false)
+
+--Weekday as decimal--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/idate_basic.phpt b/ext/date/tests/idate_basic.phpt
new file mode 100644
index 0000000..944f29f
--- /dev/null
+++ b/ext/date/tests/idate_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test idate() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : basic functionality ***\n";
+
+// Initialise all required variables
+$format = 'Y';
+
+// Calling idate() with mandatory arguments
+date_default_timezone_set("Asia/Calcutta");
+var_dump( idate($format) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : basic functionality ***
+int(%d)
+===DONE===
diff --git a/ext/date/tests/idate_error.phpt b/ext/date/tests/idate_error.phpt
new file mode 100644
index 0000000..7dad460
--- /dev/null
+++ b/ext/date/tests/idate_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test idate() function : error conditions
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : error conditions ***\n";
+
+echo "\n-- Testing idate() function with Zero arguments --\n";
+var_dump( idate() );
+
+echo "\n-- Testing idate() function with more than expected no. of arguments --\n";
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+$extra_arg = 10;
+var_dump( idate($format, $timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : error conditions ***
+
+-- Testing idate() function with Zero arguments --
+
+Warning: idate() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing idate() function with more than expected no. of arguments --
+
+Warning: idate() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/idate_variation1.phpt b/ext/date/tests/idate_variation1.phpt
new file mode 100644
index 0000000..c0231a6
--- /dev/null
+++ b/ext/date/tests/idate_variation1.phpt
@@ -0,0 +1,301 @@
+--TEST--
+Test idate() function : usage variation - Passing unexpected values to first argument 'format'.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( idate($value) );
+ var_dump( idate($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+--int 0--
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+--int 1--
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+--int 12345--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--int -12345--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float 10.5--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float -10.5--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float 12.3456789000e10--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float -12.3456789000e10--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--float .5--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--empty array--
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--lowercase null--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--lowercase true--
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+--lowercase false--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--uppercase TRUE--
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+Warning: idate(): Unrecognized date format token. in %s on line %d
+bool(false)
+
+--uppercase FALSE--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--empty string DQ--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: idate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: idate() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+--unset var--
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+
+Warning: idate(): idate format is one char in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/idate_variation2.phpt b/ext/date/tests/idate_variation2.phpt
new file mode 100644
index 0000000..7dd761d
--- /dev/null
+++ b/ext/date/tests/idate_variation2.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test idate() function : usage variation - Passing unexpected values to second optional argument 'timestamp'.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$format = 'Y';
+date_default_timezone_set("Asia/Calcutta");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( idate($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+--float 10.5--
+int(1970)
+
+--float -10.5--
+int(1970)
+
+--float .5--
+int(1970)
+
+--empty array--
+
+Warning: idate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: idate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: idate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: idate() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+int(1970)
+
+--lowercase null--
+int(1970)
+
+--lowercase true--
+int(1970)
+
+--lowercase false--
+int(1970)
+
+--uppercase TRUE--
+int(1970)
+
+--uppercase FALSE--
+int(1970)
+
+--empty string DQ--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: idate() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: idate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: idate() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+int(1970)
+
+--unset var--
+int(1970)
+===DONE===
diff --git a/ext/date/tests/idate_variation3.phpt b/ext/date/tests/idate_variation3.phpt
new file mode 100644
index 0000000..1a2ee1f
--- /dev/null
+++ b/ext/date/tests/idate_variation3.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test idate() function : usage variation - Passing higher positive and negetive float values to timestamp.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$format = 'Y';
+date_default_timezone_set("Asia/Calcutta");
+
+echo "\n-- Testing idate() function with float 12.3456789000e10 to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( idate($format, $timestamp) );
+
+echo "\n-- Testing idate() function with float -12.3456789000e10 to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( idate($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing idate\(\) : usage variation \*\*\*
+
+-- Testing idate\(\) function with float 12.3456789000e10 to timestamp --
+int\((1935|5882)\)
+
+-- Testing idate\(\) function with float -12.3456789000e10 to timestamp --
+int\((2004|1901|-1943)\)
+===DONE===
diff --git a/ext/date/tests/idate_variation4.phpt b/ext/date/tests/idate_variation4.phpt
new file mode 100644
index 0000000..6aa1735
--- /dev/null
+++ b/ext/date/tests/idate_variation4.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test idate() function : usage variation - Passing supported Date format characters to format argument.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Day of the month' => 'd',
+ 'Leap Year' =>'L',
+ 'Month number' => 'm',
+ 'Days in the month' => 't',
+ 'Day of the week' => 'w',
+ 'ISO-8601 week number' => 'W',
+ 'Year (1 or 2 digits)' => 'y',
+ 'Year 4 digits' => 'Y',
+ 'Day of the year' => 'z',
+);
+
+// loop through each element of the array for timestamp
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( idate($value) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+--Day of the month--
+int(%d)
+
+--Leap Year--
+int(%d)
+
+--Month number--
+int(%d)
+
+--Days in the month--
+int(%d)
+
+--Day of the week--
+int(%d)
+
+--ISO-8601 week number--
+int(%d)
+
+--Year (1 or 2 digits)--
+int(%d)
+
+--Year 4 digits--
+int(%d)
+
+--Day of the year--
+int(%d)
+===DONE===
diff --git a/ext/date/tests/idate_variation5.phpt b/ext/date/tests/idate_variation5.phpt
new file mode 100644
index 0000000..e70509c
--- /dev/null
+++ b/ext/date/tests/idate_variation5.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test idate() function : usage variation - Passing supported Time format characters to format argument.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Internet Time' => 'B',
+ '12 hour format' => 'h',
+ '24 hour format' => 'H',
+ 'Minutes' => 'i',
+ 'DST Activated' => 'I',
+ 'Seconds' => 's',
+ 'Seconds since Unix Epoch' => 'U',
+ 'Time zone offset' => 'Z'
+);
+
+// loop through each element of the array for timestamp
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( idate($value) );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+--Internet Time--
+int(%d)
+
+--12 hour format--
+int(%d)
+
+--24 hour format--
+int(%d)
+
+--Minutes--
+int(%d)
+
+--DST Activated--
+int(%d)
+
+--Seconds--
+int(%d)
+
+--Seconds since Unix Epoch--
+int(%d)
+
+--Time zone offset--
+int(%d)
+===DONE===
diff --git a/ext/date/tests/idate_variation6.phpt b/ext/date/tests/idate_variation6.phpt
new file mode 100644
index 0000000..161a80d
--- /dev/null
+++ b/ext/date/tests/idate_variation6.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test idate() function : usage variation - Checking return of year(1 or 2 digits) format starting with zero and nonzero.
+--FILE--
+<?php
+/* Prototype : int idate(string format [, int timestamp])
+ * Description: Format a local time/date as integer
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing idate() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+date_default_timezone_set("Asia/Calcutta");
+$format = 'y';
+
+echo "\n-- Testing idate() function for 2 digit year having no zero as starting number --\n";
+$timestamp = mktime(8, 8, 8, 8, 8, 1970);
+var_dump( idate($format, $timestamp) );
+
+echo "\n-- Testing idate() function for 2 digit year having zero as starting number --\n";
+$timestamp = mktime(8, 8, 8, 8, 8, 2001);
+var_dump( idate($format, $timestamp) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing idate() : usage variation ***
+
+-- Testing idate() function for 2 digit year having no zero as starting number --
+int(70)
+
+-- Testing idate() function for 2 digit year having zero as starting number --
+int(1)
+===DONE===
diff --git a/ext/date/tests/localtime_basic.phpt b/ext/date/tests/localtime_basic.phpt
new file mode 100644
index 0000000..fcfd636
--- /dev/null
+++ b/ext/date/tests/localtime_basic.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test localtime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : basic functionality ***\n";
+
+date_default_timezone_set("UTC");
+
+// Initialise all required variables
+$timestamp = 10;
+$associative_array = true;
+
+// Calling localtime() with all possible arguments
+var_dump( localtime($timestamp, $associative_array) );
+
+// Calling localtime() with possible optional arguments
+var_dump( localtime($timestamp) );
+
+// Calling localtime() with mandatory arguments
+var_dump( localtime() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : basic functionality ***
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(%d)
+ [5]=>
+ int(%d)
+ [6]=>
+ int(%d)
+ [7]=>
+ int(%d)
+ [8]=>
+ int(%d)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_error.phpt b/ext/date/tests/localtime_error.phpt
new file mode 100644
index 0000000..b231ed0
--- /dev/null
+++ b/ext/date/tests/localtime_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test localtime() function : error conditions
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing localtime() : error conditions ***\n";
+
+echo "\n-- Testing localtime() function with more than expected no. of arguments --\n";
+$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
+$assoc = true;
+$extra_arg = 10;
+var_dump( localtime($timestamp, $assoc, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : error conditions ***
+
+-- Testing localtime() function with more than expected no. of arguments --
+
+Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/localtime_variation1.phpt b/ext/date/tests/localtime_variation1.phpt
new file mode 100644
index 0000000..472b32b
--- /dev/null
+++ b/ext/date/tests/localtime_variation1.phpt
@@ -0,0 +1,658 @@
+--TEST--
+Test localtime() function : usage variation - Passing unexpected values to first argument 'timestamp'.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( localtime($value) );
+ var_dump( localtime($value, $is_associative) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--float 10.5--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float -10.5--
+array(9) {
+ [0]=>
+ int(50)
+ [1]=>
+ int(59)
+ [2]=>
+ int(23)
+ [3]=>
+ int(31)
+ [4]=>
+ int(11)
+ [5]=>
+ int(69)
+ [6]=>
+ int(3)
+ [7]=>
+ int(364)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(50)
+ ["tm_min"]=>
+ int(59)
+ ["tm_hour"]=>
+ int(23)
+ ["tm_mday"]=>
+ int(31)
+ ["tm_mon"]=>
+ int(11)
+ ["tm_year"]=>
+ int(69)
+ ["tm_wday"]=>
+ int(3)
+ ["tm_yday"]=>
+ int(364)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float .5--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--empty array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--lowercase null--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--lowercase true--
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(1)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--lowercase false--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--uppercase TRUE--
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(1)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--uppercase FALSE--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--empty string DQ--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+Warning: localtime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--unset var--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation2.phpt b/ext/date/tests/localtime_variation2.phpt
new file mode 100644
index 0000000..a204820
--- /dev/null
+++ b/ext/date/tests/localtime_variation2.phpt
@@ -0,0 +1,643 @@
+--TEST--
+Test localtime() function : usage variation - Passing unexpected values to second argument 'associative_array'.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$timestamp = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for associative_array
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( localtime($timestamp, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--int 0--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--int 1--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--int 12345--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--int -12345--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float 10.5--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float -10.5--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float 12.3456789000e10--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float -12.3456789000e10--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--float .5--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--empty array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: localtime() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--lowercase null--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--lowercase true--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--lowercase false--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--uppercase TRUE--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--uppercase FALSE--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--empty string DQ--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--empty string SQ--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--string DQ--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--string SQ--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--mixed case string--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--heredoc--
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--instance of classWithToString--
+
+Warning: localtime() expects parameter 2 to be boolean, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: localtime() expects parameter 2 to be boolean, object given in %s on line %d
+bool(false)
+
+--undefined var--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+
+--unset var--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation3.phpt b/ext/date/tests/localtime_variation3.phpt
new file mode 100644
index 0000000..d941e38
--- /dev/null
+++ b/ext/date/tests/localtime_variation3.phpt
@@ -0,0 +1,116 @@
+--TEST--
+Test localtime() function : usage variation - Passing higher positive and negetive float values to timestamp.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( localtime($timestamp) );
+var_dump( localtime($timestamp, $is_associative) );
+
+echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( localtime($timestamp) );
+var_dump( localtime($timestamp, $is_associative) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing localtime\(\) : usage variation \*\*\*
+
+-- Testing localtime\(\) function with 'float 12.3456789000e10' to timestamp --
+array\(9\) {
+ \[0\]=>
+ int\((16|0)\)
+ \[1\]=>
+ int\((50|30)\)
+ \[2\]=>
+ int\((4|0)\)
+ \[3\]=>
+ int\((26|11)\)
+ \[4\]=>
+ int\(2\)
+ \[5\]=>
+ int\((35|3982)\)
+ \[6\]=>
+ int\((2|6)\)
+ \[7\]=>
+ int\((84|69)\)
+ \[8\]=>
+ int\(0\)
+}
+array\(9\) {
+ \["tm_sec"\]=>
+ int\((16|0)\)
+ \["tm_min"\]=>
+ int\((50|30)\)
+ \["tm_hour"\]=>
+ int\((4|0)\)
+ \["tm_mday"\]=>
+ int\((26|11)\)
+ \["tm_mon"\]=>
+ int\(2\)
+ \["tm_year"\]=>
+ int\((35|3982)\)
+ \["tm_wday"\]=>
+ int\((2|6)\)
+ \["tm_yday"\]=>
+ int\((84|69)\)
+ \["tm_isdst"\]=>
+ int\(0\)
+}
+
+-- Testing localtime\(\) function with 'float -12.3456789000e10' to timestamp --
+array\(9\) {
+ \[0\]=>
+ int\((44|52|0)\)
+ \[1\]=>
+ int\((9|45|30)\)
+ \[2\]=>
+ int\((19|20|23)\)
+ \[3\]=>
+ int\((8|13|22)\)
+ \[4\]=>
+ int\((9|11)\)
+ \[5\]=>
+ int\((104|1|-3843)\)
+ \[6\]=>
+ int\((5|-5)\)
+ \[7\]=>
+ int\((281|346|294)\)
+ \[8\]=>
+ int\(0\)
+}
+array\(9\) {
+ \["tm_sec"\]=>
+ int\((44|52|0)\)
+ \["tm_min"\]=>
+ int\((9|45|30)\)
+ \["tm_hour"\]=>
+ int\((19|20|23)\)
+ \["tm_mday"\]=>
+ int\((8|13|22)\)
+ \["tm_mon"\]=>
+ int\((9|11)\)
+ \["tm_year"\]=>
+ int\((104|1|-3843)\)
+ \["tm_wday"\]=>
+ int\((5|-5)\)
+ \["tm_yday"\]=>
+ int\((281|346|294)\)
+ \["tm_isdst"\]=>
+ int\(0\)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation4.phpt b/ext/date/tests/localtime_variation4.phpt
new file mode 100644
index 0000000..2796c22
--- /dev/null
+++ b/ext/date/tests/localtime_variation4.phpt
@@ -0,0 +1,162 @@
+--TEST--
+Test localtime() function : usage variation - Passing octal values to timestamp.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Octal 0' => 00,
+ 'Octal 10' => 012,
+ 'Octal -10' => -012
+);
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( localtime($value) );
+ var_dump( localtime($value, $is_associative) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--Octal 0--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--Octal 10--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--Octal -10--
+array(9) {
+ [0]=>
+ int(50)
+ [1]=>
+ int(59)
+ [2]=>
+ int(23)
+ [3]=>
+ int(31)
+ [4]=>
+ int(11)
+ [5]=>
+ int(69)
+ [6]=>
+ int(3)
+ [7]=>
+ int(364)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(50)
+ ["tm_min"]=>
+ int(59)
+ ["tm_hour"]=>
+ int(23)
+ ["tm_mday"]=>
+ int(31)
+ ["tm_mon"]=>
+ int(11)
+ ["tm_year"]=>
+ int(69)
+ ["tm_wday"]=>
+ int(3)
+ ["tm_yday"]=>
+ int(364)
+ ["tm_isdst"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/localtime_variation5.phpt b/ext/date/tests/localtime_variation5.phpt
new file mode 100644
index 0000000..883e348
--- /dev/null
+++ b/ext/date/tests/localtime_variation5.phpt
@@ -0,0 +1,162 @@
+--TEST--
+Test localtime() function : usage variation - Passing hexa decimal values to timestamp.
+--FILE--
+<?php
+/* Prototype : array localtime([int timestamp [, bool associative_array]])
+ * Description: Returns the results of the C system call localtime as an associative array
+ * if the associative_array argument is set to 1 other wise it is a regular array
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing localtime() : usage variation ***\n";
+
+date_default_timezone_set("UTC");
+// Initialise function arguments not being substituted (if any)
+$is_associative = true;
+
+//array of values to iterate over
+$inputs = array(
+
+ 'Hexa-decimal 0' => 0x0,
+ 'Hexa-decimal 10' => 0xA,
+ 'Hexa-decimal -10' => -0XA
+);
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( localtime($value) );
+ var_dump( localtime($value, $is_associative) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing localtime() : usage variation ***
+
+--Hexa-decimal 0--
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--Hexa-decimal 10--
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(0)
+ [5]=>
+ int(70)
+ [6]=>
+ int(4)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(10)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(1)
+ ["tm_mon"]=>
+ int(0)
+ ["tm_year"]=>
+ int(70)
+ ["tm_wday"]=>
+ int(4)
+ ["tm_yday"]=>
+ int(0)
+ ["tm_isdst"]=>
+ int(0)
+}
+
+--Hexa-decimal -10--
+array(9) {
+ [0]=>
+ int(50)
+ [1]=>
+ int(59)
+ [2]=>
+ int(23)
+ [3]=>
+ int(31)
+ [4]=>
+ int(11)
+ [5]=>
+ int(69)
+ [6]=>
+ int(3)
+ [7]=>
+ int(364)
+ [8]=>
+ int(0)
+}
+array(9) {
+ ["tm_sec"]=>
+ int(50)
+ ["tm_min"]=>
+ int(59)
+ ["tm_hour"]=>
+ int(23)
+ ["tm_mday"]=>
+ int(31)
+ ["tm_mon"]=>
+ int(11)
+ ["tm_year"]=>
+ int(69)
+ ["tm_wday"]=>
+ int(3)
+ ["tm_yday"]=>
+ int(364)
+ ["tm_isdst"]=>
+ int(0)
+}
+===DONE===
diff --git a/ext/date/tests/microtime_basic.phpt b/ext/date/tests/microtime_basic.phpt
new file mode 100644
index 0000000..88c4952
--- /dev/null
+++ b/ext/date/tests/microtime_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test return type and value for expected input microtime()
+--FILE--
+<?php
+/*
+ * proto mixed microtime([bool get_as_float])
+ * Function is implemented in ext/standard/microtime.c
+*/
+
+var_dump(microtime());
+var_dump(microtime(true));
+var_dump(microtime(false));
+
+?>
+===DONE===
+--EXPECTF--
+string(%d) "%s %s"
+float(%s)
+string(%d) "%s %s"
+===DONE===
diff --git a/ext/date/tests/microtime_error.phpt b/ext/date/tests/microtime_error.phpt
new file mode 100644
index 0000000..07ac908
--- /dev/null
+++ b/ext/date/tests/microtime_error.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test wrong number of arguments for microtime()
+--FILE--
+<?php
+/*
+ * proto mixed microtime([bool get_as_float])
+ * Function is implemented in ext/standard/microtime.c
+*/
+
+$opt_arg_0 = true;
+$extra_arg = 1;
+
+echo "\n-- Too many arguments --\n";
+var_dump(microtime($opt_arg_0, $extra_arg));
+
+
+echo "\n-- Bad Arg types --\n";
+
+$bad_args = array(null,
+ 1.5,
+ "hello",
+ array('k'=>'v', array(0)),
+ new stdClass,
+ 1);
+foreach ($bad_args as $bad_arg) {
+ echo "\n--> bad arg: ";
+ var_dump($bad_arg);
+ var_dump(microtime($bad_arg));
+}
+
+?>
+===DONE===
+--EXPECTF--
+
+-- Too many arguments --
+
+Warning: microtime() expects at most 1 parameter, 2 given in %s on line 11
+NULL
+
+-- Bad Arg types --
+
+--> bad arg: NULL
+string(%d) "%s %s"
+
+--> bad arg: float(1.5)
+float(%s)
+
+--> bad arg: string(5) "hello"
+float(%s)
+
+--> bad arg: array(2) {
+ ["k"]=>
+ string(1) "v"
+ [0]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+}
+
+Warning: microtime() expects parameter 1 to be boolean, array given in %s on line 25
+NULL
+
+--> bad arg: object(stdClass)#%d (0) {
+}
+
+Warning: microtime() expects parameter 1 to be boolean, object given in %s on line 25
+NULL
+
+--> bad arg: int(1)
+float(%s)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/mktime-1.phpt b/ext/date/tests/mktime-1.phpt
new file mode 100644
index 0000000..87fc0df
--- /dev/null
+++ b/ext/date/tests/mktime-1.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Check for mktime with out-of-range parameters
+--INI--
+error_reporting=2047
+--FILE--
+<?php
+ date_default_timezone_set("Europe/Amsterdam");
+ # MacOS/X libc implementation doesn't treat out-of-range values
+ # the same way other unices do (Bug# 10686) so some extra code
+ # was added to datetime.c to take care of this
+ echo date("Y-m-d", mktime( 12, 0, 0, 3, 0, 2000)) ."\n";
+ echo date("Y-m-d", mktime( 12, 0, 0, 3, -1, 2000)) ."\n";
+ echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2000)) ."\n";
+ echo date("Y-m-d", mktime( 12, 0, 0, 3, 0, 2001)) ."\n";
+ echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2001)) ."\n";
+ echo date("Y-m-d", mktime( 12, 0, 0, 0, 0, 2000)) ."\n";
+
+ putenv("TZ=Europe/London");
+ echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,-1))."\n";
+ echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,0))."\n";
+ echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,1))."\n";
+ echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,-1))."\n";
+ echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,0))."\n";
+ echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,1))."\n";
+ echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,-1))."\n";
+ echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,0))."\n";
+ echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,1))."\n";
+?>
+--EXPECT--
+2000-02-29
+2000-02-28
+2000-02-29
+2001-02-28
+2001-03-01
+1999-11-30
+2000-05-29 12:00:00
+2000-05-29 13:00:00
+2000-05-29 12:00:00
+2000-01-31 12:00:00
+2000-01-31 12:00:00
+2000-01-31 11:00:00
+2000-04-29 12:00:00
+2000-04-29 13:00:00
+2000-04-29 12:00:00
diff --git a/ext/date/tests/mktime-2.phpt b/ext/date/tests/mktime-2.phpt
new file mode 100644
index 0000000..931f637
--- /dev/null
+++ b/ext/date/tests/mktime-2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+mktime() [2]
+--INI--
+error_reporting=2047
+--FILE--
+<?php
+$timezones = array(
+ 'UTC',
+ 'Europe/London'
+);
+
+foreach($timezones as $timezone)
+{
+ date_default_timezone_set($timezone);
+
+ /* status of daylight saving time unknown */
+ var_dump(mktime(0, 0, 0, 1, 1, 2002));
+ /* status of daylight saving time unknown */
+ var_dump(mktime(0, 0, 0, 1, 1, 2002, -1));
+ /* daylight saving time is not in effect */
+ var_dump(mktime(0, 0, 0, 1, 1, 2002, 0));
+ /* daylight saving time is in effect */
+ var_dump(mktime(0, 0, 0, 1, 1, 2002, 1));
+
+ /* status of daylight saving time unknown */
+ var_dump(mktime(0, 0, 0, 7, 1, 2002));
+ /* status of daylight saving time unknown */
+ var_dump(mktime(0, 0, 0, 7, 1, 2002, -1));
+ /* daylight saving time is not in effect */
+ var_dump(mktime(0, 0, 0, 7, 1, 2002, 0));
+ /* daylight saving time is in effect */
+ var_dump(mktime(0, 0, 0, 7, 1, 2002, 1));
+}
+?>
+--EXPECTF--
+int(1009843200)
+int(1009843200)
+int(1009843200)
+int(%s)
+int(1025481600)
+int(1025481600)
+int(1025481600)
+int(%s)
+int(1009843200)
+int(1009843200)
+int(1009843200)
+int(1009839600)
+int(1025478000)
+int(1025478000)
+int(1025481600)
+int(1025478000)
diff --git a/ext/date/tests/mktime-3-64bit.phpt b/ext/date/tests/mktime-3-64bit.phpt
new file mode 100644
index 0000000..a3649cd
--- /dev/null
+++ b/ext/date/tests/mktime-3-64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+mktime() [3] (64-bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK" ?>
+--INI--
+error_reporting=2047
+--FILE--
+<?php
+$tzs = array("America/Toronto", "Europe/Oslo");
+$years = array(0, 69, 70, 71, 99, 100, 101, 105, 110, 1900, 1901, 1902, 1999, 2000, 2001);
+
+foreach ($tzs as $tz) {
+ echo $tz, "\n";
+ date_default_timezone_set($tz);
+ foreach ($years as $year) {
+ printf("Y: %4d - ", $year);
+ $ret = mktime(1, 1, 1, 1, 1, $year);
+ if ($ret == FALSE) {
+ echo "out of range\n";
+ } else {
+ echo date("F ".DATE_ISO8601, $ret), "\n";
+ }
+ }
+ echo "\n";
+}
+?>
+--EXPECT--
+America/Toronto
+Y: 0 - January 2000-01-01T01:01:01-0500
+Y: 69 - January 2069-01-01T01:01:01-0500
+Y: 70 - January 1970-01-01T01:01:01-0500
+Y: 71 - January 1971-01-01T01:01:01-0500
+Y: 99 - January 1999-01-01T01:01:01-0500
+Y: 100 - January 2000-01-01T01:01:01-0500
+Y: 101 - January 0101-01-01T01:01:01-0500
+Y: 105 - January 0105-01-01T01:01:01-0500
+Y: 110 - January 0110-01-01T01:01:01-0500
+Y: 1900 - January 1900-01-01T01:01:01-0500
+Y: 1901 - January 1901-01-01T01:01:01-0500
+Y: 1902 - January 1902-01-01T01:01:01-0500
+Y: 1999 - January 1999-01-01T01:01:01-0500
+Y: 2000 - January 2000-01-01T01:01:01-0500
+Y: 2001 - January 2001-01-01T01:01:01-0500
+
+Europe/Oslo
+Y: 0 - January 2000-01-01T01:01:01+0100
+Y: 69 - January 2069-01-01T01:01:01+0100
+Y: 70 - January 1970-01-01T01:01:01+0100
+Y: 71 - January 1971-01-01T01:01:01+0100
+Y: 99 - January 1999-01-01T01:01:01+0100
+Y: 100 - January 2000-01-01T01:01:01+0100
+Y: 101 - January 0101-01-01T01:01:01+0100
+Y: 105 - January 0105-01-01T01:01:01+0100
+Y: 110 - January 0110-01-01T01:01:01+0100
+Y: 1900 - January 1900-01-01T01:01:01+0100
+Y: 1901 - January 1901-01-01T01:01:01+0100
+Y: 1902 - January 1902-01-01T01:01:01+0100
+Y: 1999 - January 1999-01-01T01:01:01+0100
+Y: 2000 - January 2000-01-01T01:01:01+0100
+Y: 2001 - January 2001-01-01T01:01:01+0100
diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt
new file mode 100644
index 0000000..4347826
--- /dev/null
+++ b/ext/date/tests/mktime-3.phpt
@@ -0,0 +1,59 @@
+--TEST--
+mktime() [3] (32-bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK" ?>
+--INI--
+error_reporting=2047
+--FILE--
+<?php
+$tzs = array("America/Toronto", "Europe/Oslo");
+$years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001);
+
+foreach ($tzs as $tz) {
+ echo $tz, "\n";
+ date_default_timezone_set($tz);
+ foreach ($years as $year) {
+ printf("Y: %4d - ", $year);
+ $ret = mktime(1, 1, 1, 1, 1, $year);
+ if ($ret == FALSE) {
+ echo "out of range\n";
+ } else {
+ echo date("F ".DATE_ISO8601, $ret), "\n";
+ }
+ }
+ echo "\n";
+}
+?>
+===Done===
+--EXPECT--
+America/Toronto
+Y: 0 - January 2000-01-01T01:01:01-0500
+Y: 69 - out of range
+Y: 70 - January 1970-01-01T01:01:01-0500
+Y: 71 - January 1971-01-01T01:01:01-0500
+Y: 99 - January 1999-01-01T01:01:01-0500
+Y: 100 - January 2000-01-01T01:01:01-0500
+Y: 105 - out of range
+Y: 1900 - out of range
+Y: 1901 - out of range
+Y: 1902 - January 1902-01-01T01:01:01-0500
+Y: 1999 - January 1999-01-01T01:01:01-0500
+Y: 2000 - January 2000-01-01T01:01:01-0500
+Y: 2001 - January 2001-01-01T01:01:01-0500
+
+Europe/Oslo
+Y: 0 - January 2000-01-01T01:01:01+0100
+Y: 69 - out of range
+Y: 70 - January 1970-01-01T01:01:01+0100
+Y: 71 - January 1971-01-01T01:01:01+0100
+Y: 99 - January 1999-01-01T01:01:01+0100
+Y: 100 - January 2000-01-01T01:01:01+0100
+Y: 105 - out of range
+Y: 1900 - out of range
+Y: 1901 - out of range
+Y: 1902 - January 1902-01-01T01:01:01+0100
+Y: 1999 - January 1999-01-01T01:01:01+0100
+Y: 2000 - January 2000-01-01T01:01:01+0100
+Y: 2001 - January 2001-01-01T01:01:01+0100
+
+===Done=== \ No newline at end of file
diff --git a/ext/date/tests/mktime_basic1.phpt b/ext/date/tests/mktime_basic1.phpt
new file mode 100644
index 0000000..dc17c29
--- /dev/null
+++ b/ext/date/tests/mktime_basic1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test mktime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+error_reporting(E_ALL | E_STRICT);
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing DateTime::modify() : basic functionality ***\n";
+
+$hour = 10;
+$minute = 30;
+$sec = 45;
+$month = 7;
+$day = 2;
+$year = 1963;
+$is_dst = 0;
+
+var_dump( mktime($hour) );
+var_dump( mktime($hour, $minute) );
+var_dump( mktime($hour, $minute, $sec) );
+var_dump( mktime($hour, $minute, $sec, $month) );
+var_dump( mktime($hour, $minute, $sec, $month, $day) );
+var_dump( mktime($hour, $minute, $sec, $month, $day, $year) );
+var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $is_dst) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing DateTime::modify() : basic functionality ***
+int(%i)
+int(%i)
+int(%i)
+int(%i)
+int(%i)
+int(%i)
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+===DONE===
+
diff --git a/ext/date/tests/mktime_error.phpt b/ext/date/tests/mktime_error.phpt
new file mode 100644
index 0000000..f517dc8
--- /dev/null
+++ b/ext/date/tests/mktime_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test mktime() function : error conditions
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+error_reporting(E_ALL | E_STRICT);
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing mktime() : error conditions ***\n";
+
+echo "\n-- Testing mktime() function with Zero arguments --\n";
+var_dump( mktime() );
+
+echo "\n-- Testing mktime() function with more than expected no. of arguments --\n";
+$hour = 10;
+$minute = 30;
+$sec = 45;
+$month = 7;
+$day = 2;
+$year = 1963;
+$is_dst = 0;
+$extra_arg = 10;
+var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $is_dst, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mktime() : error conditions ***
+
+-- Testing mktime() function with Zero arguments --
+
+Strict Standards: mktime(): You should be using the time() function instead in %s on line %d
+int(%d)
+
+-- Testing mktime() function with more than expected no. of arguments --
+
+Warning: mktime() expects at most 7 parameters, 8 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/mktime_variation1.phpt b/ext/date/tests/mktime_variation1.phpt
new file mode 100644
index 0000000..eec97da
--- /dev/null
+++ b/ext/date/tests/mktime_variation1.phpt
@@ -0,0 +1,224 @@
+--TEST--
+Test mktime() function : usage variation - Passing unexpected values to first argument $hour.
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mktime() : usage variation - unexpected values to first argument \$hour***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$hour = 10;
+$minute = 30;
+$sec = 45;
+$month = 7;
+$day = 2;
+$year = 1963;
+$is_dst = 0;
+
+foreach($inputs as $variation =>$hour) {
+ echo "\n-- $variation --\n";
+ var_dump( mktime($hour) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mktime() : usage variation - unexpected values to first argument $hour***
+
+-- int 0 --
+int(%i)
+
+-- int 12345 --
+int(%i)
+
+-- int -12345 --
+int(%i)
+
+-- float 10.5 --
+int(%i)
+
+-- float -10.5 --
+int(%i)
+
+-- float .5 --
+int(%i)
+
+-- empty array --
+
+Warning: mktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: mktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: mktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: mktime() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+int(%i)
+
+-- lowercase null --
+int(%i)
+
+-- lowercase true --
+int(%i)
+
+-- lowercase false --
+int(%i)
+
+-- uppercase TRUE --
+int(%i)
+
+-- uppercase FALSE --
+int(%i)
+
+-- empty string DQ --
+
+Warning: mktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: mktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: mktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: mktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: mktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: mktime() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: mktime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: mktime() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+int(%i)
+
+-- unset var --
+int(%i)
+
+-- resource --
+
+Warning: mktime() expects parameter 1 to be long, resource given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/mktime_variation2.phpt b/ext/date/tests/mktime_variation2.phpt
new file mode 100644
index 0000000..a969b32
--- /dev/null
+++ b/ext/date/tests/mktime_variation2.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test mktime() function : usage variation - Passing unexpected values to second argument $minute.
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mktime() : usage variation - unexpected values to second argument \$minute***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$hour = 10;
+
+foreach($inputs as $variation =>$minute) {
+ echo "\n-- $variation --\n";
+ var_dump( mktime($hour, $minute) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mktime() : usage variation - unexpected values to second argument $minute***
+
+-- int 0 --
+int(%i)
+
+-- int 12345 --
+int(%i)
+
+-- int -12345 --
+int(%i)
+
+-- float 10.5 --
+int(%i)
+
+-- float -10.5 --
+int(%i)
+
+-- float .5 --
+int(%i)
+
+-- empty array --
+
+Warning: mktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: mktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: mktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: mktime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+int(%i)
+
+-- lowercase null --
+int(%i)
+
+-- lowercase true --
+int(%i)
+
+-- lowercase false --
+int(%i)
+
+-- uppercase TRUE --
+int(%i)
+
+-- uppercase FALSE --
+int(%i)
+
+-- empty string DQ --
+
+Warning: mktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: mktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: mktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: mktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: mktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: mktime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: mktime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: mktime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+int(%i)
+
+-- unset var --
+int(%i)
+
+-- resource --
+
+Warning: mktime() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/mktime_variation3.phpt b/ext/date/tests/mktime_variation3.phpt
new file mode 100644
index 0000000..52155f8
--- /dev/null
+++ b/ext/date/tests/mktime_variation3.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test mktime() function : usage variation - Passing unexpected values to third argument $second.
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mktime() : usage variation - unexpected values to third argument \$second***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$hour = 10;
+$minute = 30;
+
+foreach($inputs as $variation =>$second) {
+ echo "\n-- $variation --\n";
+ var_dump( mktime($hour, $minute, $second) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mktime() : usage variation - unexpected values to third argument $second***
+
+-- int 0 --
+int(%i)
+
+-- int 12345 --
+int(%i)
+
+-- int -12345 --
+int(%i)
+
+-- float 10.5 --
+int(%i)
+
+-- float -10.5 --
+int(%i)
+
+-- float .5 --
+int(%i)
+
+-- empty array --
+
+Warning: mktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: mktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: mktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: mktime() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+int(%i)
+
+-- lowercase null --
+int(%i)
+
+-- lowercase true --
+int(%i)
+
+-- lowercase false --
+int(%i)
+
+-- uppercase TRUE --
+int(%i)
+
+-- uppercase FALSE --
+int(%i)
+
+-- empty string DQ --
+
+Warning: mktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: mktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: mktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: mktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: mktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: mktime() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: mktime() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: mktime() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+int(%i)
+
+-- unset var --
+int(%i)
+
+-- resource --
+
+Warning: mktime() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/mktime_variation4.phpt b/ext/date/tests/mktime_variation4.phpt
new file mode 100644
index 0000000..3b0e200
--- /dev/null
+++ b/ext/date/tests/mktime_variation4.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test mktime() function : usage variation - Passing unexpected values to forth argument $month.
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mktime() : usage variation - unexpected values to forth argument \$month***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$hour = 10;
+$minute = 30;
+$second = 45;
+
+foreach($inputs as $variation =>$month) {
+ echo "\n-- $variation --\n";
+ var_dump( mktime($hour, $minute, $second, $month) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mktime() : usage variation - unexpected values to forth argument $month***
+
+-- int 0 --
+int(%i)
+
+-- int 12345 --
+%rint\(-?[1-9][0-9]*\)|bool\(false\)%r
+
+-- int -12345 --
+%rint\(-?[1-9][0-9]*\)|bool\(false\)%r
+
+-- float 10.5 --
+int(%i)
+
+-- float -10.5 --
+int(%i)
+
+-- float .5 --
+int(%i)
+
+-- empty array --
+
+Warning: mktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: mktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: mktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: mktime() expects parameter 4 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+int(%i)
+
+-- lowercase null --
+int(%i)
+
+-- lowercase true --
+int(%i)
+
+-- lowercase false --
+int(%i)
+
+-- uppercase TRUE --
+int(%i)
+
+-- uppercase FALSE --
+int(%i)
+
+-- empty string DQ --
+
+Warning: mktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: mktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: mktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: mktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: mktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: mktime() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: mktime() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: mktime() expects parameter 4 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+int(%i)
+
+-- unset var --
+int(%i)
+
+-- resource --
+
+Warning: mktime() expects parameter 4 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/mktime_variation5.phpt b/ext/date/tests/mktime_variation5.phpt
new file mode 100644
index 0000000..4e3690a
--- /dev/null
+++ b/ext/date/tests/mktime_variation5.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test mktime() function : usage variation - Passing unexpected values to fifth argument $day.
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mktime() : usage variation - unexpected values to fifth argument \$day***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$hour = 10;
+$minute = 30;
+$second = 45;
+$month = 7;
+
+foreach($inputs as $variation =>$day) {
+ echo "\n-- $variation --\n";
+ var_dump( mktime($hour, $minute, $second, $month, $day) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mktime() : usage variation - unexpected values to fifth argument $day***
+
+-- int 0 --
+int(%i)
+
+-- int 12345 --
+%rint\(-?[1-9][0-9]*\)|bool\(false\)%r
+
+-- int -12345 --
+int(%i)
+
+-- float 10.5 --
+int(%i)
+
+-- float -10.5 --
+int(%i)
+
+-- float .5 --
+int(%i)
+
+-- empty array --
+
+Warning: mktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: mktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: mktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: mktime() expects parameter 5 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+int(%i)
+
+-- lowercase null --
+int(%i)
+
+-- lowercase true --
+int(%i)
+
+-- lowercase false --
+int(%i)
+
+-- uppercase TRUE --
+int(%i)
+
+-- uppercase FALSE --
+int(%i)
+
+-- empty string DQ --
+
+Warning: mktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: mktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: mktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: mktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: mktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: mktime() expects parameter 5 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: mktime() expects parameter 5 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: mktime() expects parameter 5 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+int(%i)
+
+-- unset var --
+int(%i)
+
+-- resource --
+
+Warning: mktime() expects parameter 5 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/mktime_variation6.phpt b/ext/date/tests/mktime_variation6.phpt
new file mode 100644
index 0000000..d0961ff
--- /dev/null
+++ b/ext/date/tests/mktime_variation6.phpt
@@ -0,0 +1,223 @@
+--TEST--
+Test mktime() function : usage variation - Passing unexpected values to sixth argument $year.
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mktime() : usage variation - unexpected values to sixth argument \$year***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$hour = 10;
+$minute = 30;
+$second = 45;
+$month = 7;
+$day = 2;
+
+foreach($inputs as $variation =>$year) {
+ echo "\n-- $variation --\n";
+ var_dump( mktime($hour, $minute, $second, $month, $day, $year) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mktime() : usage variation - unexpected values to sixth argument $year***
+
+-- int 0 --
+int(%i)
+
+-- int 12345 --
+%rint\(-?[1-9][0-9]*\)|bool\(false\)%r
+
+-- int -12345 --
+%rint\(-?[1-9][0-9]*\)|bool\(false\)%r
+
+-- float 10.5 --
+int(%i)
+
+-- float -10.5 --
+%rint\(-?[1-9][0-9]*\)|bool\(false\)%r
+
+-- float .5 --
+int(%i)
+
+-- empty array --
+
+Warning: mktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: mktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: mktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: mktime() expects parameter 6 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+int(%i)
+
+-- lowercase null --
+int(%i)
+
+-- lowercase true --
+int(%i)
+
+-- lowercase false --
+int(%i)
+
+-- uppercase TRUE --
+int(%i)
+
+-- uppercase FALSE --
+int(%i)
+
+-- empty string DQ --
+
+Warning: mktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: mktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: mktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: mktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: mktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: mktime() expects parameter 6 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: mktime() expects parameter 6 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: mktime() expects parameter 6 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+int(%i)
+
+-- unset var --
+int(%i)
+
+-- resource --
+
+Warning: mktime() expects parameter 6 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/date/tests/mktime_variation7.phpt b/ext/date/tests/mktime_variation7.phpt
new file mode 100644
index 0000000..33c36d5
--- /dev/null
+++ b/ext/date/tests/mktime_variation7.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test mktime() function : usage variation - Passing unexpected values to seventh argument $is_dst.
+--FILE--
+<?php
+/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] )
+ * Description: Get Unix timestamp for a date
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mktime() : usage variation - unexpected values to seventh argument \$is_dst***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 0' => 1,
+ 'int 0' => -1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$hour = 10;
+$minute = 30;
+$second = 45;
+$month = 7;
+$day = 2;
+$year = 1963;
+
+foreach($inputs as $variation =>$is_dst) {
+ echo "\n-- $variation --\n";
+ var_dump( mktime($hour, $minute, $second, $month, $day, $year, $is_dst) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mktime() : usage variation - unexpected values to seventh argument $is_dst***
+
+-- int 0 --
+int(%i)
+
+-- int 12345 --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- int -12345 --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- float 10.5 --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(-205165755)
+
+-- float -10.5 --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- float .5 --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(-205162155)
+
+-- empty array --
+
+Warning: mktime() expects parameter 7 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: mktime() expects parameter 7 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: mktime() expects parameter 7 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: mktime() expects parameter 7 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- lowercase null --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- lowercase true --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- lowercase false --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- uppercase TRUE --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- uppercase FALSE --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- empty string DQ --
+
+Warning: mktime() expects parameter 7 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: mktime() expects parameter 7 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: mktime() expects parameter 7 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: mktime() expects parameter 7 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: mktime() expects parameter 7 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: mktime() expects parameter 7 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: mktime() expects parameter 7 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: mktime() expects parameter 7 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- unset var --
+
+Deprecated: mktime(): The is_dst parameter is deprecated in %s on line %d
+int(%i)
+
+-- resource --
+
+Warning: mktime() expects parameter 7 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/oo_001.phpt b/ext/date/tests/oo_001.phpt
new file mode 100644
index 0000000..7cbf847
--- /dev/null
+++ b/ext/date/tests/oo_001.phpt
@@ -0,0 +1,52 @@
+--TEST--
+date OO interface
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+class _d extends DateTime {
+ function __construct() {
+ }
+}
+class _t extends DateTimeZone {
+ function __construct() {
+ }
+}
+
+$d = new DateTime;
+var_dump($d->format("Y-m-d H:i:s"));
+
+$d = new _d;
+var_dump($d->format("Y-m-d H:i:s"));
+
+try {
+ new DateTime("1am todax");
+} catch (Exception $e) {
+ echo $e->getMessage(),"\n";
+}
+
+$t = new DateTimeZone("UTC");
+var_dump($t->getName());
+
+$t = new _t;
+var_dump($t->getName());
+
+try {
+ new DateTimeZone("GottaFindThisOne");
+} catch (Exception $e) {
+ echo $e->getMessage(),"\n";
+}
+
+echo "DONE\n";
+?>
+--EXPECTF--
+string(19) "%d-%d-%d %d:%d:%d"
+
+Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %soo_001.php on line %d
+bool(false)
+DateTime::__construct(): Failed to parse time string (1am todax) at position 4 (t): The timezone could not be found in the database
+string(3) "UTC"
+
+Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in %soo_001.php on line %d
+bool(false)
+DateTimeZone::__construct(): Unknown or bad timezone (GottaFindThisOne)
+DONE
diff --git a/ext/date/tests/oo_002.phpt b/ext/date/tests/oo_002.phpt
new file mode 100644
index 0000000..34e6941
--- /dev/null
+++ b/ext/date/tests/oo_002.phpt
@@ -0,0 +1,27 @@
+--TEST--
+date OO cloning
+--FILE--
+<?php
+date_default_timezone_set('Europe/Berlin');
+class _d extends DateTime {}
+class _t extends DateTimeZone {}
+$d = new _d("1pm Aug 1 GMT 2007");
+var_dump($d->format(DateTime::RFC822));
+$c = clone $d;
+var_dump($c->format(DateTime::RFC822));
+$d->modify("1 hour");
+$c->modify("1 second ago");
+var_dump($d->format(DateTime::RFC822));
+var_dump($c->format(DateTime::RFC822));
+$t = new _t("Asia/Tokyo");
+var_dump($t->getName());
+$c = clone $t;
+var_dump($c->getName());
+?>
+--EXPECT--
+string(29) "Wed, 01 Aug 07 13:00:00 +0000"
+string(29) "Wed, 01 Aug 07 13:00:00 +0000"
+string(29) "Wed, 01 Aug 07 14:00:00 +0000"
+string(29) "Wed, 01 Aug 07 12:59:59 +0000"
+string(10) "Asia/Tokyo"
+string(10) "Asia/Tokyo"
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt
new file mode 100644
index 0000000..c297608
--- /dev/null
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt
@@ -0,0 +1,380 @@
+--TEST--
+RFC: DateTime and Daylight Saving Time Transitions (zone type 1)
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+date_default_timezone_set('America/New_York');
+$date_format = 'Y-m-d H:i:s e';
+$interval_format = 'P%dDT%hH';
+
+/*
+ * Forward Transitions, diff().
+ */
+
+$end = new DateTime('2010-03-14 03:00:00 -0400');
+$start = new DateTime('2010-03-14 01:59:59 -0500');
+echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+
+$end = new DateTime('2010-03-14 04:30:00 -0400');
+$start = new DateTime('2010-03-13 04:30:00 -0500');
+echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00 -0400');
+$start = new DateTime('2010-03-13 04:30:00 -0500');
+echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00 -0500');
+$start = new DateTime('2010-03-13 04:30:00 -0500');
+echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00 -0500');
+$start = new DateTime('2010-03-13 01:30:00 -0500');
+echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00 -0400');
+$start = new DateTime('2010-03-13 03:30:00 -0500');
+echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00 -0400');
+$start = new DateTime('2010-03-13 02:30:00 -0500');
+echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+echo "\n";
+
+/*
+ * Forward Transitions, add().
+ */
+
+$start = new DateTime('2010-03-14 01:59:59 -0500');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00 -0500');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00 -0500');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00 -0500');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 01:30:00 -0500');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 02:30:00 -0500');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+/*
+ * Forward Transitions, sub().
+ */
+
+$end = new DateTime('2010-03-14 03:00:00 -0400');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 04:30:00 -0400');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00 -0400');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00 -0500');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00 -0500');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-15 03:30:00 -0400');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-15 02:30:00 -0400');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+/*
+ * Backward Transitions, diff().
+ */
+
+$end = new DateTime('2010-11-07 01:00:00 -0500');
+$start = new DateTime('2010-11-07 01:59:59 -0400');
+echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+
+$end = new DateTime('2010-11-07 04:30:00 -0500');
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00 -0500');
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00 -0500');
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 -0500');
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 -0400');
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 -0400');
+$start = new DateTime('2010-11-06 01:30:00 -0400');
+echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 -0500');
+$start = new DateTime('2010-11-06 01:30:00 -0400');
+echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+echo "\n";
+
+/*
+ * Backward Transitions, add().
+ */
+
+$start = new DateTime('2010-11-07 01:59:59 -0400');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+$interval_spec = 'PT24H';
+$interval = new DateInterval($interval_spec);
+echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+$interval_spec = 'PT23H';
+$interval = new DateInterval($interval_spec);
+echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 01:30:00 -0400');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 01:30:00 -0400');
+$interval_spec = 'P1DT1H';
+$interval = new DateInterval($interval_spec);
+echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 -0400');
+$interval_spec = 'PT25H';
+$interval = new DateInterval($interval_spec);
+echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 03:30:00 -0400');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 02:30:00 -0400');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+/*
+ * Backward Transitions, sub().
+ */
+
+$end = new DateTime('2010-11-07 01:00:00 -0500');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 04:30:00 -0500');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00 -0500');
+$interval_spec = 'PT24H';
+$interval = new DateInterval($interval_spec);
+echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00 -0500');
+$interval_spec = 'PT23H';
+$interval = new DateInterval($interval_spec);
+echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 -0500');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 -0400');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 -0400');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 -0500');
+$interval_spec = 'P1DT1H';
+$interval = new DateInterval($interval_spec);
+echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00 -0500');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00 -0500');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+?>
+--EXPECT--
+fd1 2010-03-14 03:00:00 -04:00 - 2010-03-14 01:59:59 -05:00 = PT0H0M1S
+fd2 2010-03-14 04:30:00 -04:00 - 2010-03-13 04:30:00 -05:00 = P0DT23H
+fd3 2010-03-14 03:30:00 -04:00 - 2010-03-13 04:30:00 -05:00 = P0DT22H
+fd4 2010-03-14 01:30:00 -05:00 - 2010-03-13 04:30:00 -05:00 = P0DT21H
+fd5 2010-03-14 01:30:00 -05:00 - 2010-03-13 01:30:00 -05:00 = P1DT0H
+fd6 2010-03-14 03:30:00 -04:00 - 2010-03-13 03:30:00 -05:00 = P0DT23H
+fd7 2010-03-14 03:30:00 -04:00 - 2010-03-13 02:30:00 -05:00 = P1DT0H
+
+fa1 2010-03-14 01:59:59 -05:00 + PT1S = 2010-03-14 02:00:00 -05:00
+fa2 2010-03-13 04:30:00 -05:00 + P1D = 2010-03-14 04:30:00 -05:00
+fa3 2010-03-13 04:30:00 -05:00 + PT22H = 2010-03-14 02:30:00 -05:00
+fa4 2010-03-13 04:30:00 -05:00 + PT21H = 2010-03-14 01:30:00 -05:00
+fa5 2010-03-13 01:30:00 -05:00 + P1D = 2010-03-14 01:30:00 -05:00
+fa6 2010-03-13 02:30:00 -05:00 + P1D = 2010-03-14 02:30:00 -05:00
+
+fs1 2010-03-14 03:00:00 -04:00 - PT1S = 2010-03-14 02:59:59 -04:00
+fs2 2010-03-14 04:30:00 -04:00 - P1D = 2010-03-13 04:30:00 -04:00
+fs3 2010-03-14 03:30:00 -04:00 - PT22H = 2010-03-13 05:30:00 -04:00
+fs4 2010-03-14 01:30:00 -05:00 - PT21H = 2010-03-13 04:30:00 -05:00
+fs5 2010-03-14 01:30:00 -05:00 - P1D = 2010-03-13 01:30:00 -05:00
+fs6 2010-03-15 03:30:00 -04:00 - P1D = 2010-03-14 03:30:00 -04:00
+fs7 2010-03-15 02:30:00 -04:00 - P1D = 2010-03-14 02:30:00 -04:00
+
+bd1 2010-11-07 01:00:00 -05:00 - 2010-11-07 01:59:59 -04:00 = PT0H0M1S
+bd2 2010-11-07 04:30:00 -05:00 - 2010-11-06 04:30:00 -04:00 = P1DT1H
+bd3 2010-11-07 03:30:00 -05:00 - 2010-11-06 04:30:00 -04:00 = P1DT0H
+bd4 2010-11-07 02:30:00 -05:00 - 2010-11-06 04:30:00 -04:00 = P0DT23H
+bd5 2010-11-07 01:30:00 -05:00 - 2010-11-06 04:30:00 -04:00 = P0DT22H
+bd6 2010-11-07 01:30:00 -04:00 - 2010-11-06 04:30:00 -04:00 = P0DT21H
+bd7 2010-11-07 01:30:00 -04:00 - 2010-11-06 01:30:00 -04:00 = P1DT0H
+bd8 2010-11-07 01:30:00 -05:00 - 2010-11-06 01:30:00 -04:00 = P1DT1H
+
+ba1 2010-11-07 01:59:59 -04:00 + PT1S = 2010-11-07 02:00:00 -04:00
+ba2 2010-11-06 04:30:00 -04:00 + P1D = 2010-11-07 04:30:00 -04:00
+ba3 2010-11-06 04:30:00 -04:00 + PT24H = 2010-11-07 04:30:00 -04:00
+ba4 2010-11-06 04:30:00 -04:00 + PT23H = 2010-11-07 03:30:00 -04:00
+ba5 2010-11-06 04:30:00 -04:00 + PT22H = 2010-11-07 02:30:00 -04:00
+ba6 2010-11-06 04:30:00 -04:00 + PT21H = 2010-11-07 01:30:00 -04:00
+ba7 2010-11-06 01:30:00 -04:00 + P1D = 2010-11-07 01:30:00 -04:00
+ba8 2010-11-06 01:30:00 -04:00 + P1DT1H = 2010-11-07 02:30:00 -04:00
+ba9 2010-11-06 04:30:00 -04:00 + PT25H = 2010-11-07 05:30:00 -04:00
+ba10 2010-11-06 03:30:00 -04:00 + P1D = 2010-11-07 03:30:00 -04:00
+ba11 2010-11-06 02:30:00 -04:00 + P1D = 2010-11-07 02:30:00 -04:00
+
+bs1 2010-11-07 01:00:00 -05:00 - PT1S = 2010-11-07 00:59:59 -05:00
+bs2 2010-11-07 04:30:00 -05:00 - P1D = 2010-11-06 04:30:00 -05:00
+bs3 2010-11-07 03:30:00 -05:00 - PT24H = 2010-11-06 03:30:00 -05:00
+bs4 2010-11-07 02:30:00 -05:00 - PT23H = 2010-11-06 03:30:00 -05:00
+bs5 2010-11-07 01:30:00 -05:00 - PT22H = 2010-11-06 03:30:00 -05:00
+bs6 2010-11-07 01:30:00 -04:00 - PT21H = 2010-11-06 04:30:00 -04:00
+bs7 2010-11-07 01:30:00 -04:00 - P1D = 2010-11-06 01:30:00 -04:00
+bs8 2010-11-07 01:30:00 -05:00 - P1DT1H = 2010-11-06 00:30:00 -05:00
+bs9 2010-11-07 03:30:00 -05:00 - P1D = 2010-11-06 03:30:00 -05:00
+bs10 2010-11-07 02:30:00 -05:00 - P1D = 2010-11-06 02:30:00 -05:00
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
new file mode 100644
index 0000000..7258512
--- /dev/null
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
@@ -0,0 +1,380 @@
+--TEST--
+RFC: DateTime and Daylight Saving Time Transitions (zone type 2)
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--FILE--
+<?php
+
+date_default_timezone_set('America/New_York');
+$date_format = 'Y-m-d H:i:s T e';
+$interval_format = 'P%dDT%hH';
+
+/*
+ * Forward Transitions, diff().
+ */
+
+$end = new DateTime('2010-03-14 03:00:00 EDT');
+$start = new DateTime('2010-03-14 01:59:59 EST');
+echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+
+$end = new DateTime('2010-03-14 04:30:00 EDT');
+$start = new DateTime('2010-03-13 04:30:00 EST');
+echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00 EDT');
+$start = new DateTime('2010-03-13 04:30:00 EST');
+echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00 EST');
+$start = new DateTime('2010-03-13 04:30:00 EST');
+echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00 EST');
+$start = new DateTime('2010-03-13 01:30:00 EST');
+echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00 EDT');
+$start = new DateTime('2010-03-13 03:30:00 EST');
+echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00 EDT');
+$start = new DateTime('2010-03-13 02:30:00 EST');
+echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+echo "\n";
+
+/*
+ * Forward Transitions, add().
+ */
+
+$start = new DateTime('2010-03-14 01:59:59 EST');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00 EST');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00 EST');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00 EST');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 01:30:00 EST');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 02:30:00 EST');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+/*
+ * Forward Transitions, sub().
+ */
+
+$end = new DateTime('2010-03-14 03:00:00 EDT');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 04:30:00 EDT');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00 EDT');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00 EST');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00 EST');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-15 03:30:00 EDT');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-15 02:30:00 EDT');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+/*
+ * Backward Transitions, diff().
+ */
+
+$end = new DateTime('2010-11-07 01:00:00 EST');
+$start = new DateTime('2010-11-07 01:59:59 EDT');
+echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+
+$end = new DateTime('2010-11-07 04:30:00 EST');
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00 EST');
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00 EST');
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EST');
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EDT');
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EDT');
+$start = new DateTime('2010-11-06 01:30:00 EDT');
+echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EST');
+$start = new DateTime('2010-11-06 01:30:00 EDT');
+echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+echo "\n";
+
+/*
+ * Backward Transitions, add().
+ */
+
+$start = new DateTime('2010-11-07 01:59:59 EDT');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+$interval_spec = 'PT24H';
+$interval = new DateInterval($interval_spec);
+echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+$interval_spec = 'PT23H';
+$interval = new DateInterval($interval_spec);
+echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 01:30:00 EDT');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 01:30:00 EDT');
+$interval_spec = 'P1DT1H';
+$interval = new DateInterval($interval_spec);
+echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00 EDT');
+$interval_spec = 'PT25H';
+$interval = new DateInterval($interval_spec);
+echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 03:30:00 EDT');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 02:30:00 EDT');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+/*
+ * Backward Transitions, sub().
+ */
+
+$end = new DateTime('2010-11-07 01:00:00 EST');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 04:30:00 EST');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00 EST');
+$interval_spec = 'PT24H';
+$interval = new DateInterval($interval_spec);
+echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00 EST');
+$interval_spec = 'PT23H';
+$interval = new DateInterval($interval_spec);
+echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EST');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EDT');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EDT');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EST');
+$interval_spec = 'P1DT1H';
+$interval = new DateInterval($interval_spec);
+echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00 EST');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00 EST');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+?>
+--EXPECT--
+fd1 2010-03-14 03:00:00 EDT EDT - 2010-03-14 01:59:59 EST EST = PT0H0M1S
+fd2 2010-03-14 04:30:00 EDT EDT - 2010-03-13 04:30:00 EST EST = P0DT23H
+fd3 2010-03-14 03:30:00 EDT EDT - 2010-03-13 04:30:00 EST EST = P0DT22H
+fd4 2010-03-14 01:30:00 EST EST - 2010-03-13 04:30:00 EST EST = P0DT21H
+fd5 2010-03-14 01:30:00 EST EST - 2010-03-13 01:30:00 EST EST = P1DT0H
+fd6 2010-03-14 03:30:00 EDT EDT - 2010-03-13 03:30:00 EST EST = P0DT23H
+fd7 2010-03-14 03:30:00 EDT EDT - 2010-03-13 02:30:00 EST EST = P1DT0H
+
+fa1 2010-03-14 01:59:59 EST EST + PT1S = 2010-03-14 02:00:00 EST EST
+fa2 2010-03-13 04:30:00 EST EST + P1D = 2010-03-14 04:30:00 EST EST
+fa3 2010-03-13 04:30:00 EST EST + PT22H = 2010-03-14 02:30:00 EST EST
+fa4 2010-03-13 04:30:00 EST EST + PT21H = 2010-03-14 01:30:00 EST EST
+fa5 2010-03-13 01:30:00 EST EST + P1D = 2010-03-14 01:30:00 EST EST
+fa6 2010-03-13 02:30:00 EST EST + P1D = 2010-03-14 02:30:00 EST EST
+
+fs1 2010-03-14 03:00:00 EDT EDT - PT1S = 2010-03-14 02:59:59 EDT EDT
+fs2 2010-03-14 04:30:00 EDT EDT - P1D = 2010-03-13 04:30:00 EDT EDT
+fs3 2010-03-14 03:30:00 EDT EDT - PT22H = 2010-03-13 05:30:00 EDT EDT
+fs4 2010-03-14 01:30:00 EST EST - PT21H = 2010-03-13 04:30:00 EST EST
+fs5 2010-03-14 01:30:00 EST EST - P1D = 2010-03-13 01:30:00 EST EST
+fs6 2010-03-15 03:30:00 EDT EDT - P1D = 2010-03-14 03:30:00 EDT EDT
+fs7 2010-03-15 02:30:00 EDT EDT - P1D = 2010-03-14 02:30:00 EDT EDT
+
+bd1 2010-11-07 01:00:00 EST EST - 2010-11-07 01:59:59 EDT EDT = PT0H0M1S
+bd2 2010-11-07 04:30:00 EST EST - 2010-11-06 04:30:00 EDT EDT = P1DT1H
+bd3 2010-11-07 03:30:00 EST EST - 2010-11-06 04:30:00 EDT EDT = P1DT0H
+bd4 2010-11-07 02:30:00 EST EST - 2010-11-06 04:30:00 EDT EDT = P0DT23H
+bd5 2010-11-07 01:30:00 EST EST - 2010-11-06 04:30:00 EDT EDT = P0DT22H
+bd6 2010-11-07 01:30:00 EDT EDT - 2010-11-06 04:30:00 EDT EDT = P0DT21H
+bd7 2010-11-07 01:30:00 EDT EDT - 2010-11-06 01:30:00 EDT EDT = P1DT0H
+bd8 2010-11-07 01:30:00 EST EST - 2010-11-06 01:30:00 EDT EDT = P1DT1H
+
+ba1 2010-11-07 01:59:59 EDT EDT + PT1S = 2010-11-07 02:00:00 EDT EDT
+ba2 2010-11-06 04:30:00 EDT EDT + P1D = 2010-11-07 04:30:00 EDT EDT
+ba3 2010-11-06 04:30:00 EDT EDT + PT24H = 2010-11-07 04:30:00 EDT EDT
+ba4 2010-11-06 04:30:00 EDT EDT + PT23H = 2010-11-07 03:30:00 EDT EDT
+ba5 2010-11-06 04:30:00 EDT EDT + PT22H = 2010-11-07 02:30:00 EDT EDT
+ba6 2010-11-06 04:30:00 EDT EDT + PT21H = 2010-11-07 01:30:00 EDT EDT
+ba7 2010-11-06 01:30:00 EDT EDT + P1D = 2010-11-07 01:30:00 EDT EDT
+ba8 2010-11-06 01:30:00 EDT EDT + P1DT1H = 2010-11-07 02:30:00 EDT EDT
+ba9 2010-11-06 04:30:00 EDT EDT + PT25H = 2010-11-07 05:30:00 EDT EDT
+ba10 2010-11-06 03:30:00 EDT EDT + P1D = 2010-11-07 03:30:00 EDT EDT
+ba11 2010-11-06 02:30:00 EDT EDT + P1D = 2010-11-07 02:30:00 EDT EDT
+
+bs1 2010-11-07 01:00:00 EST EST - PT1S = 2010-11-07 00:59:59 EST EST
+bs2 2010-11-07 04:30:00 EST EST - P1D = 2010-11-06 04:30:00 EST EST
+bs3 2010-11-07 03:30:00 EST EST - PT24H = 2010-11-06 03:30:00 EST EST
+bs4 2010-11-07 02:30:00 EST EST - PT23H = 2010-11-06 03:30:00 EST EST
+bs5 2010-11-07 01:30:00 EST EST - PT22H = 2010-11-06 03:30:00 EST EST
+bs6 2010-11-07 01:30:00 EDT EDT - PT21H = 2010-11-06 04:30:00 EDT EDT
+bs7 2010-11-07 01:30:00 EDT EDT - P1D = 2010-11-06 01:30:00 EDT EDT
+bs8 2010-11-07 01:30:00 EST EST - P1DT1H = 2010-11-06 00:30:00 EST EST
+bs9 2010-11-07 03:30:00 EST EST - P1D = 2010-11-06 03:30:00 EST EST
+bs10 2010-11-07 02:30:00 EST EST - P1D = 2010-11-06 02:30:00 EST EST
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3.phpt
new file mode 100644
index 0000000..855fe4e
--- /dev/null
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3.phpt
@@ -0,0 +1,399 @@
+--TEST--
+RFC: DateTime and Daylight Saving Time Transitions (zone type 3)
+--CREDITS--
+Daniel Convissor <danielc@php.net>
+--XFAIL--
+RFC not implemented yet
+--FILE--
+<?php
+
+date_default_timezone_set('America/New_York');
+$date_format = 'Y-m-d H:i:s T e';
+$interval_format = 'P%dDT%hH';
+
+/*
+ * Forward Transitions, diff().
+ */
+
+$end = new DateTime('2010-03-14 03:00:00');
+$start = new DateTime('2010-03-14 01:59:59');
+echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+
+$end = new DateTime('2010-03-14 04:30:00');
+$start = new DateTime('2010-03-13 04:30:00');
+echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00');
+$start = new DateTime('2010-03-13 04:30:00');
+echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00');
+$start = new DateTime('2010-03-13 04:30:00');
+echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00');
+$start = new DateTime('2010-03-13 01:30:00');
+echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00');
+$start = new DateTime('2010-03-13 03:30:00');
+echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00');
+$start = new DateTime('2010-03-13 02:30:00');
+echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+echo "\n";
+
+/*
+ * Forward Transitions, add().
+ */
+
+$start = new DateTime('2010-03-14 01:59:59');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 04:30:00');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 01:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-03-13 02:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+/*
+ * Forward Transitions, sub().
+ */
+
+$end = new DateTime('2010-03-14 03:00:00');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 04:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 03:30:00');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-14 01:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-15 03:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-03-15 02:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+
+/*
+ * For backward transitions, must create objects with zone type 2
+ * where specifying Daylight or Standard time is required
+ * then converting them to zone type 3.
+ */
+
+$tz = new DateTimeZone('America/New_York');
+
+/*
+ * Backward Transitions, diff().
+ */
+
+$end = new DateTime('2010-11-07 01:00:00 EST');
+$end->setTimeZone($tz);
+$start = new DateTime('2010-11-07 01:59:59');
+echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+
+$end = new DateTime('2010-11-07 04:30:00');
+$start = new DateTime('2010-11-06 04:30:00');
+echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00');
+$start = new DateTime('2010-11-06 04:30:00');
+echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00');
+$start = new DateTime('2010-11-06 04:30:00');
+echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EST');
+$end->setTimeZone($tz);
+$start = new DateTime('2010-11-06 04:30:00');
+echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EDT');
+$end->setTimeZone($tz);
+$start = new DateTime('2010-11-06 04:30:00');
+echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00');
+$start = new DateTime('2010-11-06 01:30:00');
+echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EST');
+$end->setTimeZone($tz);
+$start = new DateTime('2010-11-06 01:30:00');
+echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+
+echo "\n";
+
+/*
+ * Backward Transitions, add().
+ */
+
+$start = new DateTime('2010-11-07 01:59:59');
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00');
+$interval_spec = 'PT24H';
+$interval = new DateInterval($interval_spec);
+echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00');
+$interval_spec = 'PT23H';
+$interval = new DateInterval($interval_spec);
+echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00');
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00');
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 01:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 01:30:00');
+$interval_spec = 'P1DT1H';
+$interval = new DateInterval($interval_spec);
+echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 04:30:00');
+$interval_spec = 'PT25H';
+$interval = new DateInterval($interval_spec);
+echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 03:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+$start = new DateTime('2010-11-06 02:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = "
+ . $start->add($interval)->format($date_format) . "\n";
+
+echo "\n";
+
+/*
+ * Backward Transitions, sub().
+ */
+
+$end = new DateTime('2010-11-07 01:00:00 EST');
+$end->setTimeZone($tz);
+$interval_spec = 'PT1S';
+$interval = new DateInterval($interval_spec);
+echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 04:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00');
+$interval_spec = 'PT24H';
+$interval = new DateInterval($interval_spec);
+echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00');
+$interval_spec = 'PT23H';
+$interval = new DateInterval($interval_spec);
+echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EST');
+$end->setTimeZone($tz);
+$interval_spec = 'PT22H';
+$interval = new DateInterval($interval_spec);
+echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EDT');
+$end->setTimeZone($tz);
+$interval_spec = 'PT21H';
+$interval = new DateInterval($interval_spec);
+echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 01:30:00 EST');
+$end->setTimeZone($tz);
+$interval_spec = 'P1DT1H';
+$interval = new DateInterval($interval_spec);
+echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 03:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+$end = new DateTime('2010-11-07 02:30:00');
+$interval_spec = 'P1D';
+$interval = new DateInterval($interval_spec);
+echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = "
+ . $end->sub($interval)->format($date_format) . "\n";
+
+?>
+--EXPECT--
+fd1 2010-03-14 03:00:00 EDT America/New_York - 2010-03-14 01:59:59 EST America/New_York = PT0H0M1S
+fd2 2010-03-14 04:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P1DT0H
+fd3 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT22H
+fd4 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT21H
+fd5 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 01:30:00 EST America/New_York = P1DT0H
+fd6 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 03:30:00 EST America/New_York = P1DT0H
+fd7 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 02:30:00 EST America/New_York = P1DT1H
+
+fa1 2010-03-14 01:59:59 EST America/New_York + PT1S = 2010-03-14 03:00:00 EDT America/New_York
+fa2 2010-03-13 04:30:00 EST America/New_York + P1D = 2010-03-14 04:30:00 EDT America/New_York
+fa3 2010-03-13 04:30:00 EST America/New_York + PT22H = 2010-03-14 03:30:00 EDT America/New_York
+fa4 2010-03-13 04:30:00 EST America/New_York + PT21H = 2010-03-14 01:30:00 EST America/New_York
+fa5 2010-03-13 01:30:00 EST America/New_York + P1D = 2010-03-14 01:30:00 EST America/New_York
+fa6 2010-03-13 02:30:00 EST America/New_York + P1D = 2010-03-14 03:30:00 EDT America/New_York
+
+fs1 2010-03-14 03:00:00 EDT America/New_York - PT1S = 2010-03-14 01:59:59 EST America/New_York
+fs2 2010-03-14 04:30:00 EDT America/New_York - P1D = 2010-03-13 04:30:00 EST America/New_York
+fs3 2010-03-14 03:30:00 EDT America/New_York - PT22H = 2010-03-13 04:30:00 EST America/New_York
+fs4 2010-03-14 01:30:00 EST America/New_York - PT21H = 2010-03-13 04:30:00 EST America/New_York
+fs5 2010-03-14 01:30:00 EST America/New_York - P1D = 2010-03-13 01:30:00 EST America/New_York
+fs6 2010-03-15 03:30:00 EDT America/New_York - P1D = 2010-03-14 03:30:00 EDT America/New_York
+fs7 2010-03-15 03:30:00 EDT America/New_York - P1D = 2010-03-14 03:30:00 EDT America/New_York
+
+bd1 2010-11-07 01:00:00 EST America/New_York - 2010-11-07 01:59:59 EDT America/New_York = PT0H0M1S
+bd2 2010-11-07 04:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P1DT0H
+bd3 2010-11-07 03:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT24H
+bd4 2010-11-07 02:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT23H
+bd5 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT22H
+bd6 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT21H
+bd7 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT0H
+bd8 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT1H
+
+ba1 2010-11-07 01:59:59 EDT America/New_York + PT1S = 2010-11-07 01:00:00 EST America/New_York
+ba2 2010-11-06 04:30:00 EDT America/New_York + P1D = 2010-11-07 04:30:00 EST America/New_York
+ba3 2010-11-06 04:30:00 EDT America/New_York + PT24H = 2010-11-07 03:30:00 EST America/New_York
+ba4 2010-11-06 04:30:00 EDT America/New_York + PT23H = 2010-11-07 02:30:00 EST America/New_York
+ba5 2010-11-06 04:30:00 EDT America/New_York + PT22H = 2010-11-07 01:30:00 EST America/New_York
+ba6 2010-11-06 04:30:00 EDT America/New_York + PT21H = 2010-11-07 01:30:00 EDT America/New_York
+ba7 2010-11-06 01:30:00 EDT America/New_York + P1D = 2010-11-07 01:30:00 EDT America/New_York
+ba8 2010-11-06 01:30:00 EDT America/New_York + P1DT1H = 2010-11-07 01:30:00 EST America/New_York
+ba9 2010-11-06 04:30:00 EDT America/New_York + PT25H = 2010-11-07 04:30:00 EST America/New_York
+ba10 2010-11-06 03:30:00 EDT America/New_York + P1D = 2010-11-07 03:30:00 EST America/New_York
+ba11 2010-11-06 02:30:00 EDT America/New_York + P1D = 2010-11-07 02:30:00 EST America/New_York
+
+bs1 2010-11-07 01:00:00 EST America/New_York - PT1S = 2010-11-07 01:59:59 EDT America/New_York
+bs2 2010-11-07 04:30:00 EST America/New_York - P1D = 2010-11-06 04:30:00 EDT America/New_York
+bs3 2010-11-07 03:30:00 EST America/New_York - PT24H = 2010-11-06 04:30:00 EDT America/New_York
+bs4 2010-11-07 02:30:00 EST America/New_York - PT23H = 2010-11-06 04:30:00 EDT America/New_York
+bs5 2010-11-07 01:30:00 EST America/New_York - PT22H = 2010-11-06 04:30:00 EDT America/New_York
+bs6 2010-11-07 01:30:00 EDT America/New_York - PT21H = 2010-11-06 04:30:00 EDT America/New_York
+bs7 2010-11-07 01:30:00 EDT America/New_York - P1D = 2010-11-06 01:30:00 EDT America/New_York
+bs8 2010-11-07 01:30:00 EST America/New_York - P1DT1H = 2010-11-06 00:30:00 EDT America/New_York
+bs9 2010-11-07 03:30:00 EST America/New_York - P1D = 2010-11-06 03:30:00 EDT America/New_York
+bs10 2010-11-07 02:30:00 EST America/New_York - P1D = 2010-11-06 02:30:00 EDT America/New_York
diff --git a/ext/date/tests/strftime_basic.phpt b/ext/date/tests/strftime_basic.phpt
new file mode 100644
index 0000000..07f22af
--- /dev/null
+++ b/ext/date/tests/strftime_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test strftime() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : basic functionality ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+// Initialise all required variables
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+// Calling strftime() with all possible arguments
+var_dump( strftime($format, $timestamp) );
+
+// Calling strftime() with mandatory arguments
+var_dump( strftime($format) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : basic functionality ***
+string(20) "Aug 08 2008 08:08:08"
+string(%d) "%s %d %d %d:%d:%d"
+===DONE===
diff --git a/ext/date/tests/strftime_error.phpt b/ext/date/tests/strftime_error.phpt
new file mode 100644
index 0000000..1966379
--- /dev/null
+++ b/ext/date/tests/strftime_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test strftime() function : error conditions
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : error conditions ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+//Test strftime with one more than the expected number of arguments
+echo "\n-- Testing strftime() function with more than expected no. of arguments --\n";
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$extra_arg = 10;
+var_dump( strftime($format, $timestamp, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : error conditions ***
+
+-- Testing strftime() function with more than expected no. of arguments --
+
+Warning: strftime() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation1.phpt b/ext/date/tests/strftime_variation1.phpt
new file mode 100644
index 0000000..04b4819
--- /dev/null
+++ b/ext/date/tests/strftime_variation1.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test strftime() function : usage variation - Passing unexpected values to first argument 'format'.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+
+// Initialise function arguments not being substituted (if any)
+$timestamp = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for format
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--int 0--
+string(1) "0"
+string(1) "0"
+
+--int 1--
+string(1) "1"
+string(1) "1"
+
+--int 12345--
+string(5) "12345"
+string(5) "12345"
+
+--int -12345--
+string(6) "-12345"
+string(6) "-12345"
+
+--float 10.5--
+string(4) "10.5"
+string(4) "10.5"
+
+--float -10.5--
+string(5) "-10.5"
+string(5) "-10.5"
+
+--float 12.3456789000e10--
+string(12) "123456789000"
+string(12) "123456789000"
+
+--float -12.3456789000e10--
+string(13) "-123456789000"
+string(13) "-123456789000"
+
+--float .5--
+string(3) "0.5"
+string(3) "0.5"
+
+--empty array--
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+bool(false)
+bool(false)
+
+--lowercase null--
+bool(false)
+bool(false)
+
+--lowercase true--
+string(1) "1"
+string(1) "1"
+
+--lowercase false--
+bool(false)
+bool(false)
+
+--uppercase TRUE--
+string(1) "1"
+string(1) "1"
+
+--uppercase FALSE--
+bool(false)
+bool(false)
+
+--empty string DQ--
+bool(false)
+bool(false)
+
+--empty string SQ--
+bool(false)
+bool(false)
+
+--instance of classWithToString--
+string(14) "Class A object"
+string(14) "Class A object"
+
+--instance of classWithoutToString--
+
+Warning: strftime() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+Warning: strftime() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+--undefined var--
+bool(false)
+bool(false)
+
+--unset var--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation10.phpt b/ext/date/tests/strftime_variation10.phpt
new file mode 100644
index 0000000..7d2a1b8
--- /dev/null
+++ b/ext/date/tests/strftime_variation10.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Checking week related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--The ISO 8601:1988 week number--
+string(%d) "%d"
+string(2) "32"
+
+--Weekday as decimal--
+string(%d) "%d"
+string(1) "5"
+===DONE===
diff --git a/ext/date/tests/strftime_variation11.phpt b/ext/date/tests/strftime_variation11.phpt
new file mode 100644
index 0000000..a063f0a
--- /dev/null
+++ b/ext/date/tests/strftime_variation11.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test strftime() function : usage variation - Checking month related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing strftime() function with Abbreviated month name format %h --\n";
+$format = "%h";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with Abbreviated month name format %h --
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation12.phpt b/ext/date/tests/strftime_variation12.phpt
new file mode 100644
index 0000000..b798f42
--- /dev/null
+++ b/ext/date/tests/strftime_variation12.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test strftime() function : usage variation - Checking month related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing strftime() function with Abbreviated month name format %h --\n";
+$format = "%h";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with Abbreviated month name format %h --
+string(%d) "%s"
+string(3) "Aug"
+===DONE===
diff --git a/ext/date/tests/strftime_variation13.phpt b/ext/date/tests/strftime_variation13.phpt
new file mode 100644
index 0000000..58ad283
--- /dev/null
+++ b/ext/date/tests/strftime_variation13.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test strftime() function : usage variation - Checking date related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Century number--
+bool(false)
+bool(false)
+
+--Month Date Year--
+bool(false)
+bool(false)
+
+--Year with century--
+bool(false)
+bool(false)
+
+--Year without century--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation14.phpt b/ext/date/tests/strftime_variation14.phpt
new file mode 100644
index 0000000..7ccb7d2
--- /dev/null
+++ b/ext/date/tests/strftime_variation14.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test strftime() function : usage variation - Checking date related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Century number--
+string(%d) "%d"
+string(2) "20"
+
+--Month Date Year--
+string(%d) "%d/%d/%d"
+string(8) "08/08/08"
+
+--Year with century--
+string(%d) "%d"
+string(4) "2008"
+
+--Year without century--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation15.phpt b/ext/date/tests/strftime_variation15.phpt
new file mode 100644
index 0000000..5b2946b
--- /dev/null
+++ b/ext/date/tests/strftime_variation15.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strftime() function : usage variation - Checking time related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Time in a.m/p.m notation--
+bool(false)
+bool(false)
+
+--Time in 24 hour notation--
+bool(false)
+bool(false)
+
+--Current time %H:%M:%S format--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation16.phpt b/ext/date/tests/strftime_variation16.phpt
new file mode 100644
index 0000000..5103b3a
--- /dev/null
+++ b/ext/date/tests/strftime_variation16.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strftime() function : usage variation - Checking time related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Time in a.m/p.m notation--
+string(%d) "%d:%d:%d %s"
+string(11) "08:08:08 AM"
+
+--Time in 24 hour notation--
+string(%d) "%d:%d"
+string(5) "08:08"
+
+--Current time %H:%M:%S format--
+string(%d) "%d:%d:%d"
+string(8) "08:08:08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation17.phpt b/ext/date/tests/strftime_variation17.phpt
new file mode 100644
index 0000000..90b3269
--- /dev/null
+++ b/ext/date/tests/strftime_variation17.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test strftime() function : usage variation - Checking day related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing strftime() function with Day of the month as decimal single digit format --\n";
+$format = "%e";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with Day of the month as decimal single digit format --
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation18.phpt b/ext/date/tests/strftime_variation18.phpt
new file mode 100644
index 0000000..4340325
--- /dev/null
+++ b/ext/date/tests/strftime_variation18.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test strftime() function : usage variation - Checking day related formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+echo "\n-- Testing strftime() function with Day of the month as decimal single digit format --\n";
+$format = "%e";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with Day of the month as decimal single digit format --
+string(%d) "%s"
+string(2) " 8"
+===DONE===
diff --git a/ext/date/tests/strftime_variation19.phpt b/ext/date/tests/strftime_variation19.phpt
new file mode 100644
index 0000000..b416077
--- /dev/null
+++ b/ext/date/tests/strftime_variation19.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Checking newline and tab formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Newline character--
+bool(false)
+bool(false)
+
+--Tab character--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strftime_variation2.phpt b/ext/date/tests/strftime_variation2.phpt
new file mode 100644
index 0000000..b024234
--- /dev/null
+++ b/ext/date/tests/strftime_variation2.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test strftime() function : usage variation - Passing unexpected values to second argument 'timestamp'.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+// Initialise all required variables
+$format = '%b %d %Y %H:%M:%S';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($format, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--float 10.5--
+string(20) "Jan 01 1970 05:30:10"
+
+--float -10.5--
+string(20) "Jan 01 1970 05:29:50"
+
+--float .5--
+string(20) "Jan 01 1970 05:30:00"
+
+--empty array--
+
+Warning: strftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--int indexed array--
+
+Warning: strftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--associative array--
+
+Warning: strftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--nested arrays--
+
+Warning: strftime() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+--uppercase NULL--
+string(20) "Jan 01 1970 05:30:00"
+
+--lowercase null--
+string(20) "Jan 01 1970 05:30:00"
+
+--lowercase true--
+string(20) "Jan 01 1970 05:30:01"
+
+--lowercase false--
+string(20) "Jan 01 1970 05:30:00"
+
+--uppercase TRUE--
+string(20) "Jan 01 1970 05:30:01"
+
+--uppercase FALSE--
+string(20) "Jan 01 1970 05:30:00"
+
+--empty string DQ--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--empty string SQ--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string DQ--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--string SQ--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--mixed case string--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--heredoc--
+
+Warning: strftime() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+--instance of classWithToString--
+
+Warning: strftime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: strftime() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+--undefined var--
+string(20) "Jan 01 1970 05:30:00"
+
+--unset var--
+string(20) "Jan 01 1970 05:30:00"
+===DONE===
diff --git a/ext/date/tests/strftime_variation20.phpt b/ext/date/tests/strftime_variation20.phpt
new file mode 100644
index 0000000..336c6d2
--- /dev/null
+++ b/ext/date/tests/strftime_variation20.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test strftime() function : usage variation - Checking newline and tab formats which are supported other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing strftime\(\) : usage variation \*\*\*
+
+--Newline character--
+string\(1\) "
+"
+string\(1\) "
+"
+
+--Tab character--
+string\(1\) "\s"
+string\(1\) "\s"
+===DONE===
diff --git a/ext/date/tests/strftime_variation21.phpt b/ext/date/tests/strftime_variation21.phpt
new file mode 100644
index 0000000..f6aed15
--- /dev/null
+++ b/ext/date/tests/strftime_variation21.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strftime() function : usage variation - Checking Preferred date and time representation on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Preferred date and time representation' => "%c",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Preferred date and time representation--
+string(%d) "%d/%d/%d %d:%d:%d"
+string(17) "08/08/08 08:08:08"
+
+--Preferred date representation--
+string(%d) "%d/%d/%d"
+string(8) "08/08/08"
+
+--Preferred time representation--
+string(%d) "%d:%d:%d"
+string(8) "08:08:08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation22.phpt b/ext/date/tests/strftime_variation22.phpt
new file mode 100644
index 0000000..7b72ca5
--- /dev/null
+++ b/ext/date/tests/strftime_variation22.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test strftime() function : usage variation - Checking Preferred date and time representation other than on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ die("skip Test is not valid for Windows");
+}
+if(!setlocale(LC_ALL, "POSIX")) {
+ die("skip Locale POSIX is needed by test and is not available");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "POSIX");
+putenv("LC_ALL=POSIX");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Preferred date and time representation' => "%c",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( $value );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing strftime() : usage variation ***
+
+--Preferred date and time representation--
+string(2) "%c"
+string(24) "Fri Aug 8 08:08:08 2008"
+
+--Preferred date representation--
+string(2) "%x"
+string(8) "08/08/08"
+
+--Preferred time representation--
+string(2) "%X"
+string(8) "08:08:08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation23.phpt b/ext/date/tests/strftime_variation23.phpt
new file mode 100644
index 0000000..b7cf8d7
--- /dev/null
+++ b/ext/date/tests/strftime_variation23.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test strftime() function : usage variation - Checking large positive and negative float values to timestamp.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("UTC");
+$format = '%b %d %Y %H:%M:%S';
+
+echo "\n-- Testing strftime() function with float 12.3456789000e10 to timestamp --\n";
+$timestamp = 12.3456789000e10;
+var_dump( strftime($format, $timestamp) );
+
+echo "\n-- Testing strftime() function with float -12.3456789000e10 to timestamp --\n";
+$timestamp = -12.3456789000e10;
+var_dump( strftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing strftime\(\) : usage variation \*\*\*
+
+-- Testing strftime\(\) function with float 12.3456789000e10 to timestamp --
+string\(\d*\)\s"Mar\s(26|11)\s(1935|5882)\s(04|00):(50|30):(16|00)"
+
+-- Testing strftime\(\) function with float -12.3456789000e10 to timestamp --
+string\(\d*\)\s"(Oct|Dec)\s(08|13|22)\s(2004|1901|-1943)\s(19|20|23):(09|45|30):(44|52|00)"
+===DONE===
diff --git a/ext/date/tests/strftime_variation3.phpt b/ext/date/tests/strftime_variation3.phpt
new file mode 100644
index 0000000..342cb76
--- /dev/null
+++ b/ext/date/tests/strftime_variation3.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test strftime() function : usage variation - Passing week related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+// Initialise function arguments not being substituted (if any)
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Abbreviated weekday name' => "%a",
+ 'Full weekday name' => "%A",
+ 'Week number of the year' => "%U",
+ 'Week number of the year in decimal number' => "%W",
+);
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Abbreviated weekday name--
+string(%d) "%s"
+string(3) "Fri"
+
+--Full weekday name--
+string(%d) "%s"
+string(6) "Friday"
+
+--Week number of the year--
+string(%d) "%d"
+string(2) "31"
+
+--Week number of the year in decimal number--
+string(%d) "%d"
+string(2) "31"
+===DONE===
diff --git a/ext/date/tests/strftime_variation4.phpt b/ext/date/tests/strftime_variation4.phpt
new file mode 100644
index 0000000..6236dd9
--- /dev/null
+++ b/ext/date/tests/strftime_variation4.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test strftime() function : usage variation - Passing month related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+date_default_timezone_set("Asia/Calcutta");
+// Initialise function arguments not being substituted (if any)
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Abbreviated month name' => "%b",
+ 'Full month name' => "%B",
+ 'Month as decimal' => "%m",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Abbreviated month name--
+string(%d) "%s"
+string(3) "Aug"
+
+--Full month name--
+string(%d) "%s"
+string(6) "August"
+
+--Month as decimal--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation5.phpt b/ext/date/tests/strftime_variation5.phpt
new file mode 100644
index 0000000..90f4e37
--- /dev/null
+++ b/ext/date/tests/strftime_variation5.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Passing date related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'Year as decimal number without a century' => "%y",
+ 'Year as decimal number including the century' => "%Y",
+ 'Time zone offset' => "%Z",
+ 'Time zone offset' => "%z",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Year as decimal number without a century--
+string(%d) "%d"
+string(2) "08"
+
+--Year as decimal number including the century--
+string(%d) "%d"
+string(4) "2008"
+
+--Time zone offset--
+string(%d) "%s"
+string(%d) "%s"
+===DONE===
diff --git a/ext/date/tests/strftime_variation6.phpt b/ext/date/tests/strftime_variation6.phpt
new file mode 100644
index 0000000..6713a19
--- /dev/null
+++ b/ext/date/tests/strftime_variation6.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test strftime() function : usage variation - Passing time related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(18, 8, 8, 8, 8, 2008);
+
+
+//array of values to iterate over
+$inputs = array(
+ 'Hour as decimal by 24-hour format' => "%H",
+ 'Hour as decimal by 12-hour format' => "%I",
+ 'Minute as decimal number' => "%M",
+ 'AM/PM format for a time' => "%p",
+ 'Second as decimal number' => "%S",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Hour as decimal by 24-hour format--
+string(%d) "%d"
+string(2) "18"
+
+--Hour as decimal by 12-hour format--
+string(%d) "%d"
+string(2) "06"
+
+--Minute as decimal number--
+string(%d) "%d"
+string(2) "08"
+
+--AM/PM format for a time--
+string(%d) "%s"
+string(2) "PM"
+
+--Second as decimal number--
+string(%d) "%d"
+string(2) "08"
+===DONE===
diff --git a/ext/date/tests/strftime_variation7.phpt b/ext/date/tests/strftime_variation7.phpt
new file mode 100644
index 0000000..67fd416
--- /dev/null
+++ b/ext/date/tests/strftime_variation7.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Passing day related format strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(18, 8, 8, 8, 8, 2008);
+
+
+//array of values to iterate over
+$inputs = array(
+ 'Day of the month as a decimal number' => "%d",
+ 'Day of the year as a decimal number' => "%j",
+ 'Day of the week as a decimal number' => "%w"
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--Day of the month as a decimal number--
+string(%d) "%d"
+string(2) "08"
+
+--Day of the year as a decimal number--
+string(%d) "%d"
+string(3) "221"
+
+--Day of the week as a decimal number--
+string(%d) "%d"
+string(1) "5"
+===DONE===
diff --git a/ext/date/tests/strftime_variation8.phpt b/ext/date/tests/strftime_variation8.phpt
new file mode 100644
index 0000000..af8089f
--- /dev/null
+++ b/ext/date/tests/strftime_variation8.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test strftime() function : usage variation - Passing literal related strings to format argument.
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$format = "%%";
+
+echo "\n-- Testing strftime() function with a literal % character to format --\n";
+var_dump( strftime($format) );
+var_dump( strftime($format, $timestamp) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+-- Testing strftime() function with a literal % character to format --
+string(1) "%"
+string(1) "%"
+===DONE===
diff --git a/ext/date/tests/strftime_variation9.phpt b/ext/date/tests/strftime_variation9.phpt
new file mode 100644
index 0000000..23aa92d
--- /dev/null
+++ b/ext/date/tests/strftime_variation9.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strftime() function : usage variation - Checking week related formats which are not supported on Windows.
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ die("skip Test is valid for Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string strftime(string format [, int timestamp])
+ * Description: Format a local time/date according to locale settings
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strftime() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+setlocale(LC_ALL, "en_US");
+date_default_timezone_set("Asia/Calcutta");
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+
+//array of values to iterate over
+$inputs = array(
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
+);
+
+// loop through each element of the array for timestamp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strftime() : usage variation ***
+
+--The ISO 8601:1988 week number--
+bool(false)
+bool(false)
+
+--Weekday as decimal--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/date/tests/strtotime-mysql-64bit.phpt b/ext/date/tests/strtotime-mysql-64bit.phpt
new file mode 100644
index 0000000..38e7f15
--- /dev/null
+++ b/ext/date/tests/strtotime-mysql-64bit.phpt
@@ -0,0 +1,28 @@
+--TEST--
+strtotime() and mysql timestamps (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+/* Format: YYYYMMDDHHMMSS */
+$d[] = '19970523091528';
+$d[] = '20001231185859';
+$d[] = '20800410101010'; // overflow..
+
+foreach($d as $date) {
+ $time = strtotime($date);
+
+ if (is_integer($time)) {
+ var_dump(date('r', $time));
+ } else {
+ var_dump($time);
+ }
+}
+?>
+--EXPECT--
+string(31) "Fri, 23 May 1997 09:15:28 +0000"
+string(31) "Sun, 31 Dec 2000 18:58:59 +0000"
+string(31) "Wed, 10 Apr 2080 10:10:10 +0000"
+
diff --git a/ext/date/tests/strtotime-mysql.phpt b/ext/date/tests/strtotime-mysql.phpt
new file mode 100644
index 0000000..e5935bb
--- /dev/null
+++ b/ext/date/tests/strtotime-mysql.phpt
@@ -0,0 +1,27 @@
+--TEST--
+strtotime() and mysql timestamps (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+/* Format: YYYYMMDDHHMMSS */
+$d[] = '19970523091528';
+$d[] = '20001231185859';
+$d[] = '20800410101010'; // overflow..
+
+foreach($d as $date) {
+ $time = strtotime($date);
+
+ if (is_integer($time)) {
+ var_dump(date('r', $time));
+ } else {
+ var_dump($time);
+ }
+}
+?>
+--EXPECT--
+string(31) "Fri, 23 May 1997 09:15:28 +0000"
+string(31) "Sun, 31 Dec 2000 18:58:59 +0000"
+bool(false)
diff --git a/ext/date/tests/strtotime-relative.phpt b/ext/date/tests/strtotime-relative.phpt
new file mode 100644
index 0000000..769cd2e
--- /dev/null
+++ b/ext/date/tests/strtotime-relative.phpt
@@ -0,0 +1,98 @@
+--TEST--
+strtotime() with relative offsets
+--FILE--
+<?php
+
+date_default_timezone_set('UTC');
+
+$base_time = 1204200000; // 28 Feb 2008 12:00:00
+
+$offsets = array(
+ // offset around a day
+ '80412 seconds',
+ '86399 seconds',
+ '86400 seconds',
+ '86401 seconds',
+ '112913 seconds',
+
+ // offset around 7 days
+ '134 hours',
+ '167 hours',
+ '168 hours',
+ '169 hours',
+ '183 hours',
+
+ // offset around 6 months
+ '178 days',
+ '179 days',
+ '180 days',
+ '183 days',
+ '184 days',
+
+ // offset around 10 years
+ '115 months',
+ '119 months',
+ '120 months',
+ '121 months',
+ '128 months',
+
+ // offset around 25 years (can't do much more reliably with strtotime)
+ '24 years',
+ '25 years',
+ '26 years'
+);
+
+foreach ($offsets AS $offset) {
+ foreach (array('+', '-') AS $direction) {
+ echo "$direction$offset: " . date(DATE_ISO8601, strtotime("$direction$offset", $base_time)) . "\n";
+ }
+}
+
+?>
+--EXPECT--
++80412 seconds: 2008-02-29T10:20:12+0000
+-80412 seconds: 2008-02-27T13:39:48+0000
++86399 seconds: 2008-02-29T11:59:59+0000
+-86399 seconds: 2008-02-27T12:00:01+0000
++86400 seconds: 2008-02-29T12:00:00+0000
+-86400 seconds: 2008-02-27T12:00:00+0000
++86401 seconds: 2008-02-29T12:00:01+0000
+-86401 seconds: 2008-02-27T11:59:59+0000
++112913 seconds: 2008-02-29T19:21:53+0000
+-112913 seconds: 2008-02-27T04:38:07+0000
++134 hours: 2008-03-05T02:00:00+0000
+-134 hours: 2008-02-22T22:00:00+0000
++167 hours: 2008-03-06T11:00:00+0000
+-167 hours: 2008-02-21T13:00:00+0000
++168 hours: 2008-03-06T12:00:00+0000
+-168 hours: 2008-02-21T12:00:00+0000
++169 hours: 2008-03-06T13:00:00+0000
+-169 hours: 2008-02-21T11:00:00+0000
++183 hours: 2008-03-07T03:00:00+0000
+-183 hours: 2008-02-20T21:00:00+0000
++178 days: 2008-08-24T12:00:00+0000
+-178 days: 2007-09-03T12:00:00+0000
++179 days: 2008-08-25T12:00:00+0000
+-179 days: 2007-09-02T12:00:00+0000
++180 days: 2008-08-26T12:00:00+0000
+-180 days: 2007-09-01T12:00:00+0000
++183 days: 2008-08-29T12:00:00+0000
+-183 days: 2007-08-29T12:00:00+0000
++184 days: 2008-08-30T12:00:00+0000
+-184 days: 2007-08-28T12:00:00+0000
++115 months: 2017-09-28T12:00:00+0000
+-115 months: 1998-07-28T12:00:00+0000
++119 months: 2018-01-28T12:00:00+0000
+-119 months: 1998-03-28T12:00:00+0000
++120 months: 2018-02-28T12:00:00+0000
+-120 months: 1998-02-28T12:00:00+0000
++121 months: 2018-03-28T12:00:00+0000
+-121 months: 1998-01-28T12:00:00+0000
++128 months: 2018-10-28T12:00:00+0000
+-128 months: 1997-06-28T12:00:00+0000
++24 years: 2032-02-28T12:00:00+0000
+-24 years: 1984-02-28T12:00:00+0000
++25 years: 2033-02-28T12:00:00+0000
+-25 years: 1983-02-28T12:00:00+0000
++26 years: 2034-02-28T12:00:00+0000
+-26 years: 1982-02-28T12:00:00+0000
diff --git a/ext/date/tests/strtotime.phpt b/ext/date/tests/strtotime.phpt
new file mode 100644
index 0000000..aef7d68
--- /dev/null
+++ b/ext/date/tests/strtotime.phpt
@@ -0,0 +1,20 @@
+--TEST--
+strtotime() function
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+$d = array();
+$d[] = strtotime("2005-07-14 22:30:41");
+$d[] = strtotime("2005-07-14 22:30:41 GMT");
+$d[] = strtotime("@1121373041");
+$d[] = strtotime("@1121373041 CEST");
+
+foreach($d as $date) {
+ echo date(DATE_ISO8601, $date), "\n";
+}
+?>
+--EXPECT--
+2005-07-14T22:30:41+0200
+2005-07-15T00:30:41+0200
+2005-07-14T22:30:41+0200
+2005-07-14T22:30:41+0200
diff --git a/ext/date/tests/strtotime2.phpt b/ext/date/tests/strtotime2.phpt
new file mode 100644
index 0000000..b8b6059
--- /dev/null
+++ b/ext/date/tests/strtotime2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+strtotime() on date constants
+--FILE--
+<?php
+
+date_default_timezone_set("Europe/Oslo");
+$time = time();
+
+$constants = array(
+ 'DATE_ATOM',
+ 'DATE_COOKIE',
+ 'DATE_ISO8601',
+ 'DATE_RFC822',
+ 'DATE_RFC850',
+ 'DATE_RFC1036',
+ 'DATE_RFC1123',
+ 'DATE_RFC2822',
+ 'DATE_RFC3339',
+ 'DATE_RSS',
+ 'DATE_W3C'
+);
+
+
+foreach ($constants as $const) {
+ echo "$const:\t";
+ echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n";
+}
+?>
+--EXPECT--
+DATE_ATOM: OK
+DATE_COOKIE: OK
+DATE_ISO8601: OK
+DATE_RFC822: OK
+DATE_RFC850: OK
+DATE_RFC1036: OK
+DATE_RFC1123: OK
+DATE_RFC2822: OK
+DATE_RFC3339: OK
+DATE_RSS: OK
+DATE_W3C: OK
diff --git a/ext/date/tests/strtotime3-64bit.phpt b/ext/date/tests/strtotime3-64bit.phpt
new file mode 100644
index 0000000..7dc0816
--- /dev/null
+++ b/ext/date/tests/strtotime3-64bit.phpt
@@ -0,0 +1,71 @@
+--TEST--
+strtotime() function (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set('Europe/Lisbon');
+$time = 1150494719; // 16/June/2006
+
+$strs = array(
+ '',
+ " \t\r\n000",
+ 'yesterday',
+ '22:49:12',
+ '22:49:12 bogusTZ',
+ '22.49.12.42GMT',
+ '22.49.12.42bogusTZ',
+ 't0222',
+ 't0222 t0222',
+ '022233',
+ '022233 bogusTZ',
+ '2-3-2004',
+ '2.3.2004',
+ '20060212T23:12:23UTC',
+ '20060212T23:12:23 bogusTZ',
+ '2006167', //pgydotd
+ 'Jan-15-2006', //pgtextshort
+ '2006-Jan-15', //pgtextreverse
+ '10/Oct/2000:13:55:36 +0100', //clf
+ '10/Oct/2000:13:55:36 +00100', //clf
+ '2006',
+ '1986', // year
+ 'JAN',
+ 'January',
+);
+
+foreach ($strs as $str) {
+ $t = strtotime($str, $time);
+ if (is_integer($t)) {
+ var_dump(date(DATE_RFC2822, $t));
+ } else {
+ var_dump($t);
+ }
+}
+
+?>
+--EXPECT--
+bool(false)
+bool(false)
+string(31) "Thu, 15 Jun 2006 00:00:00 +0100"
+string(31) "Fri, 16 Jun 2006 22:49:12 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 23:49:12 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 02:22:00 +0100"
+string(31) "Mon, 16 Jun 0222 02:22:00 -0036"
+string(31) "Fri, 16 Jun 2006 02:22:33 +0100"
+bool(false)
+string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
+string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
+string(31) "Sun, 12 Feb 2006 23:12:23 +0000"
+bool(false)
+string(31) "Fri, 16 Jun 2006 00:00:00 +0100"
+string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
+string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
+string(31) "Tue, 10 Oct 2000 13:55:36 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 20:06:00 +0100"
+string(31) "Mon, 16 Jun 1986 22:51:59 +0100"
+string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
+string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
diff --git a/ext/date/tests/strtotime3.phpt b/ext/date/tests/strtotime3.phpt
new file mode 100644
index 0000000..6aa5640
--- /dev/null
+++ b/ext/date/tests/strtotime3.phpt
@@ -0,0 +1,71 @@
+--TEST--
+strtotime() function (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set('Europe/Lisbon');
+$time = 1150494719; // 16/June/2006
+
+$strs = array(
+ '',
+ " \t\r\n000",
+ 'yesterday',
+ '22:49:12',
+ '22:49:12 bogusTZ',
+ '22.49.12.42GMT',
+ '22.49.12.42bogusTZ',
+ 't0222',
+ 't0222 t0222',
+ '022233',
+ '022233 bogusTZ',
+ '2-3-2004',
+ '2.3.2004',
+ '20060212T23:12:23UTC',
+ '20060212T23:12:23 bogusTZ',
+ '2006167', //pgydotd
+ 'Jan-15-2006', //pgtextshort
+ '2006-Jan-15', //pgtextreverse
+ '10/Oct/2000:13:55:36 +0100', //clf
+ '10/Oct/2000:13:55:36 +00100', //clf
+ '2006',
+ '1986', // year
+ 'JAN',
+ 'January',
+);
+
+foreach ($strs as $str) {
+ $t = strtotime($str, $time);
+ if (is_integer($t)) {
+ var_dump(date(DATE_RFC2822, $t));
+ } else {
+ var_dump($t);
+ }
+}
+
+?>
+--EXPECT--
+bool(false)
+bool(false)
+string(31) "Thu, 15 Jun 2006 00:00:00 +0100"
+string(31) "Fri, 16 Jun 2006 22:49:12 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 23:49:12 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 02:22:00 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 02:22:33 +0100"
+bool(false)
+string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
+string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
+string(31) "Sun, 12 Feb 2006 23:12:23 +0000"
+bool(false)
+string(31) "Fri, 16 Jun 2006 00:00:00 +0100"
+string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
+string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
+string(31) "Tue, 10 Oct 2000 13:55:36 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 20:06:00 +0100"
+string(31) "Mon, 16 Jun 1986 22:51:59 +0100"
+string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
+string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
diff --git a/ext/date/tests/strtotime_basic.phpt b/ext/date/tests/strtotime_basic.phpt
new file mode 100644
index 0000000..75f6697
--- /dev/null
+++ b/ext/date/tests/strtotime_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+strtotime() function - a test to show the difference in behaviour between 'first' and '1', "second" and "2"...
+--SKIPIF--
+<?php if (!function_exists('strtotime')) echo "SKIP"; ?>
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+/*
+ * The first of December 2008 is a Monday.
+ * The term "Monday December 2008" will be parsed as the first Monday in December 2008.
+ */
+
+/*
+ * This is parsed as the "first following Monday OR the current day if it is a Monday"
+ */
+var_dump(date('Y-m-d', strtotime('1 Monday December 2008')));
+/*
+ * This is parsed as the "second following Monday OR the first following
+ * Monday if the current day is a Monday"
+ */
+var_dump(date('Y-m-d', strtotime('2 Monday December 2008')));
+/*
+ * This is parsed as the "third following Monday OR the second following
+ * Monday if the current day is a Monday"
+ */
+var_dump(date('Y-m-d', strtotime('3 Monday December 2008')));
+/*
+ * This is parsed as the "first following Monday after the first Monday in December"
+ */
+var_dump(date('Y-m-d', strtotime('first Monday December 2008')));
+/*
+ * This is parsed as the "second following Monday after the first Monday in December"
+ */
+var_dump(date('Y-m-d', strtotime('second Monday December 2008')));
+/*
+ * This is parsed as the "third following Monday after the first Monday in December"
+ */
+var_dump(date('Y-m-d', strtotime('third Monday December 2008')));
+?>
+--EXPECTF--
+%string|unicode%(10) "2008-12-01"
+%string|unicode%(10) "2008-12-08"
+%string|unicode%(10) "2008-12-15"
+%string|unicode%(10) "2008-12-08"
+%string|unicode%(10) "2008-12-15"
+%string|unicode%(10) "2008-12-22"
diff --git a/ext/date/tests/strtotime_basic2.phpt b/ext/date/tests/strtotime_basic2.phpt
new file mode 100644
index 0000000..f90e66d
--- /dev/null
+++ b/ext/date/tests/strtotime_basic2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+strtotime() with return false
+--CREDITS--
+"Anna Filina" <afilina@phpquebec.org>
+#PHPTestFest2009 2009-05-02
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+var_dump(strtotime('mayy 2 2009')); // misspelled month name
+?>
+--EXPECT--
+bool(false) \ No newline at end of file
diff --git a/ext/date/tests/strtotime_variation_scottish.phpt b/ext/date/tests/strtotime_variation_scottish.phpt
new file mode 100644
index 0000000..0b21b22
--- /dev/null
+++ b/ext/date/tests/strtotime_variation_scottish.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Checking whisky time
+--FILE--
+<?php
+ date_default_timezone_set('UTC');
+ var_dump(date('H:i:s', strtotime('back of 7')));
+ var_dump(date('H:i:s', strtotime('front of 7')));
+ var_dump(date('H:i:s', strtotime('back of 19')));
+ var_dump(date('H:i:s', strtotime('front of 19')));
+?>
+--EXPECTF--
+%string|unicode%(8) "07:15:00"
+%string|unicode%(8) "06:45:00"
+%string|unicode%(8) "19:15:00"
+%string|unicode%(8) "18:45:00"
diff --git a/ext/date/tests/sunfuncts.phpt b/ext/date/tests/sunfuncts.phpt
new file mode 100644
index 0000000..59acb12
--- /dev/null
+++ b/ext/date/tests/sunfuncts.phpt
@@ -0,0 +1,42 @@
+--TEST--
+date_sunrise() and date_sunset() functions
+--INI--
+precision=13
+--FILE--
+<?php
+date_default_timezone_set('Asia/Jerusalem');
+for($a=1;$a<=12;$a++){
+ echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." ";
+ echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." ";
+ echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n";
+
+ echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." ";
+ echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." ";
+ echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n";
+}
+?>
+--EXPECTF--
+1041395864 06:37 6.6290131458%d
+1041432452 16:47 16.792451114%d
+1044073855 06:30 6.5154089279%d
+1044112463 17:14 17.239870289%d
+1046491495 06:04 6.0822145033%d
+1046533075 17:37 17.632011035%d
+1049167581 05:26 5.4394438111%d
+1049212774 17:59 17.993035729%d
+1051757532 04:52 4.8701934126%d
+1051806007 18:20 18.335390508%d
+1054434776 04:32 4.5489827182%d
+1054485647 18:40 18.679812949%d
+1057026949 04:35 4.5971956372%d
+1057078197 18:49 18.832563396%d
+1059706409 04:53 4.8916575089%d
+1059755837 18:37 18.621440704%d
+1062385999 05:13 5.2220951121%d
+1062432291 18:04 18.080957168%d
+1064979098 05:31 5.5273199215%d
+1065021952 17:25 17.431339135%d
+1067658845 05:54 5.9016292870%d
+1067698274 16:51 16.853902453%d
+1070252387 06:19 6.3299242689%d
+1070289382 16:36 16.606312600%d
diff --git a/ext/date/tests/test-parse-from-format.phpt b/ext/date/tests/test-parse-from-format.phpt
new file mode 100644
index 0000000..2bf9c4e
--- /dev/null
+++ b/ext/date/tests/test-parse-from-format.phpt
@@ -0,0 +1,143 @@
+--TEST--
+date_create_from_format() and date_parse_from_format().
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+$formats = array( DATE_ATOM, DATE_COOKIE, DATE_ISO8601, DATE_RFC822,
+ DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339,
+ DATE_RSS, DATE_W3C );
+
+foreach( $formats as $format )
+{
+ $date = new DateTime( "2008-07-08T22:14:12+02:00" );
+ $formatted = $date->format( $format ) ;
+ $date2 = date_create_from_format( $format, $formatted );
+ var_dump( $format, $formatted, $date2 );
+ echo "\n";
+ if ( $date2 === false )
+ {
+ var_dump(date_parse_from_format( $format, $formatted ) );
+ }
+}
+?>
+--EXPECT--
+string(13) "Y-m-d\TH:i:sP"
+string(25) "2008-07-08T22:14:12+02:00"
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(16) "l, d-M-y H:i:s T"
+string(36) "Tuesday, 08-Jul-08 22:14:12 GMT+0200"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(13) "Y-m-d\TH:i:sO"
+string(24) "2008-07-08T22:14:12+0200"
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(16) "D, d M y H:i:s O"
+string(29) "Tue, 08 Jul 08 22:14:12 +0200"
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(16) "l, d-M-y H:i:s T"
+string(36) "Tuesday, 08-Jul-08 22:14:12 GMT+0200"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(16) "D, d M y H:i:s O"
+string(29) "Tue, 08 Jul 08 22:14:12 +0200"
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(16) "D, d M Y H:i:s O"
+string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(16) "D, d M Y H:i:s O"
+string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(13) "Y-m-d\TH:i:sP"
+string(25) "2008-07-08T22:14:12+02:00"
+object(DateTime)#3 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(16) "D, d M Y H:i:s O"
+string(31) "Tue, 08 Jul 2008 22:14:12 +0200"
+object(DateTime)#2 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
+
+string(13) "Y-m-d\TH:i:sP"
+string(25) "2008-07-08T22:14:12+02:00"
+object(DateTime)#1 (3) {
+ ["date"]=>
+ string(19) "2008-07-08 22:14:12"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+02:00"
+}
diff --git a/ext/date/tests/time_basic.phpt b/ext/date/tests/time_basic.phpt
new file mode 100644
index 0000000..116c0a4
--- /dev/null
+++ b/ext/date/tests/time_basic.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test return type and value for expected input time()
+--FILE--
+<?php
+/*
+ * proto int time(void)
+ * Function is implemented in ext/date/php_date.c
+*/
+
+var_dump(time());
+
+?>
+===DONE===
+--EXPECTF--
+int(%d)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/time_error.phpt b/ext/date/tests/time_error.phpt
new file mode 100644
index 0000000..853c1ba
--- /dev/null
+++ b/ext/date/tests/time_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test wrong number of arguments for time()
+--FILE--
+<?php
+/*
+ * proto int time(void)
+ * Function is implemented in ext/date/php_date.c
+*/
+
+// Extra arguments are ignored
+$extra_arg = 1;
+echo "\nToo many arguments\n";
+var_dump (time($extra_arg));
+?>
+===DONE===
+--EXPECTF--
+Too many arguments
+int(%d)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/timestamp-in-dst.phpt b/ext/date/tests/timestamp-in-dst.phpt
new file mode 100644
index 0000000..bef18ee
--- /dev/null
+++ b/ext/date/tests/timestamp-in-dst.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Format timestamp in DST test
+--INI--
+date.timezone=CEST
+--FILE--
+<?php
+error_reporting(E_ALL & ~E_WARNING); // hide e_warning warning about timezones
+var_dump( date_create( '@1202996091' )->format( 'c' ) );
+?>
+--EXPECT--
+string(25) "2008-02-14T13:34:51+00:00"
diff --git a/ext/date/tests/timezone-configuration.phpt b/ext/date/tests/timezone-configuration.phpt
new file mode 100644
index 0000000..c70d645
--- /dev/null
+++ b/ext/date/tests/timezone-configuration.phpt
@@ -0,0 +1,19 @@
+--TEST--
+timezone configuration [1]
+--INI--
+date.timezone=GMT
+--FILE--
+<?php
+ date_default_timezone_set('Europe/Oslo');
+ echo strtotime("2005-06-18 22:15:44"), "\n";
+
+ date_default_timezone_set('Europe/London');
+ echo strtotime("2005-06-18 22:15:44"), "\n";
+
+ date_default_timezone_set('Europe/Oslo');
+ echo strtotime("2005-06-18 22:15:44"), "\n";
+?>
+--EXPECT--
+1119125744
+1119129344
+1119125744
diff --git a/ext/date/tests/timezone_abbreviations_list_basic1.phpt b/ext/date/tests/timezone_abbreviations_list_basic1.phpt
new file mode 100644
index 0000000..e5dfe5d
--- /dev/null
+++ b/ext/date/tests/timezone_abbreviations_list_basic1.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test timezone_abbreviations_list() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array timezone_abbreviations_list ( void )
+ * Description: Returns associative array containing dst, offset and the timezone name
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::listAbbreviations
+ */
+
+echo "*** Testing timezone_abbreviations_list() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$abbr = timezone_abbreviations_list();
+
+var_dump( gettype($abbr) );
+var_dump( count($abbr) );
+
+echo "\n-- Format a sample entry --\n";
+var_dump( $abbr["acst"] );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_abbreviations_list() : basic functionality ***
+string(5) "array"
+int(%d)
+
+-- Format a sample entry --
+array(4) {
+ [0]=>
+ array(3) {
+ ["dst"]=>
+ bool(true)
+ ["offset"]=>
+ int(-14400)
+ ["timezone_id"]=>
+ string(18) "America/Porto_Acre"
+ }
+ [1]=>
+ array(3) {
+ ["dst"]=>
+ bool(true)
+ ["offset"]=>
+ int(-14400)
+ ["timezone_id"]=>
+ string(16) "America/Eirunepe"
+ }
+ [2]=>
+ array(3) {
+ ["dst"]=>
+ bool(true)
+ ["offset"]=>
+ int(-14400)
+ ["timezone_id"]=>
+ string(18) "America/Rio_Branco"
+ }
+ [3]=>
+ array(3) {
+ ["dst"]=>
+ bool(true)
+ ["offset"]=>
+ int(-14400)
+ ["timezone_id"]=>
+ string(11) "Brazil/Acre"
+ }
+}
+===DONE===
diff --git a/ext/date/tests/timezone_identifiers_list_basic1.phpt b/ext/date/tests/timezone_identifiers_list_basic1.phpt
new file mode 100644
index 0000000..4476da2
--- /dev/null
+++ b/ext/date/tests/timezone_identifiers_list_basic1.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test timezone_identifiers_list() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array timezone_identifiers_list ( void )
+ * Description: Returns numerically index array with all timezone identifiers
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing timezone_identifiers_list() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$zones = timezone_identifiers_list();
+echo "Check return tpe is ARRAY\n";
+var_dump(is_array($zones));
+
+echo "Check array contains some common timezones\n";
+var_dump(in_array("Europe/London", $zones));
+var_dump(in_array("America/New_York", $zones));
+var_dump(in_array("UTC", $zones));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_identifiers_list() : basic functionality ***
+Check return tpe is ARRAY
+bool(true)
+Check array contains some common timezones
+bool(true)
+bool(true)
+bool(true)
+===DONE===
+ \ No newline at end of file
diff --git a/ext/date/tests/timezone_identifiers_list_wrong_constructor.phpt b/ext/date/tests/timezone_identifiers_list_wrong_constructor.phpt
new file mode 100644
index 0000000..5b8493b
--- /dev/null
+++ b/ext/date/tests/timezone_identifiers_list_wrong_constructor.phpt
@@ -0,0 +1,15 @@
+--TEST--
+timezone_identifiers_list: Test that correct notice is given when timezone_identifiers_list is given 4096 as parameter
+--CREDITS--
+Havard Eide <nucleuz@gmail.com>
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--INI--
+error_reporting=E_ALL
+date.timezone=UTC
+--FILE--
+<?php
+print_r(timezone_identifiers_list(4096));
+
+?>
+--EXPECTF--
+Notice: timezone_identifiers_list(): A two-letter ISO 3166-1 compatible country code is expected in %s on line %d \ No newline at end of file
diff --git a/ext/date/tests/timezone_location_get.phpt b/ext/date/tests/timezone_location_get.phpt
new file mode 100644
index 0000000..745fc87
--- /dev/null
+++ b/ext/date/tests/timezone_location_get.phpt
@@ -0,0 +1,24 @@
+--TEST--
+timezone_location_get: Test that timezone_location_get returns a correct array of information
+--CREDITS--
+Havard Eide <nucleuz@gmail.com>
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$location = timezone_location_get(new DateTimeZone("Europe/Oslo"));
+var_dump($location);
+?>
+--EXPECT--
+array(4) {
+ ["country_code"]=>
+ string(2) "NO"
+ ["latitude"]=>
+ float(59.91666)
+ ["longitude"]=>
+ float(10.75)
+ ["comments"]=>
+ string(0) ""
+}
+
diff --git a/ext/date/tests/timezone_name_from_abbr_basic1.phpt b/ext/date/tests/timezone_name_from_abbr_basic1.phpt
new file mode 100644
index 0000000..b591fe2
--- /dev/null
+++ b/ext/date/tests/timezone_name_from_abbr_basic1.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test timezone_name_from_abbr() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] )
+ * Description: Returns the timezone name from abbrevation
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing timezone_name_from_abbr() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "-- Tests with special cases first - no lookup needed --\n";
+var_dump( timezone_name_from_abbr("GMT") );
+var_dump( timezone_name_from_abbr("UTC") );
+
+echo "-- Lookup with just name --\n";
+var_dump( timezone_name_from_abbr("CET") );
+var_dump( timezone_name_from_abbr("EDT") );
+
+echo "-- Lookup with name and offset--\n";
+var_dump( timezone_name_from_abbr("ADT", -10800) );
+var_dump( timezone_name_from_abbr("ADT", 14400) );
+var_dump( timezone_name_from_abbr("AKTT", 14400) );
+var_dump( timezone_name_from_abbr("aktt", 18000) );
+var_dump( timezone_name_from_abbr("Aktt", 21600) );
+var_dump( timezone_name_from_abbr("AMST", -10800) );
+var_dump( timezone_name_from_abbr("amst", 180000) );
+
+echo "-- Tests without valid name - uses gmtOffset and isdst to find match --\n";
+var_dump( timezone_name_from_abbr("", 3600, 1) );
+var_dump( timezone_name_from_abbr("FOO", -7200, 1) );
+var_dump( timezone_name_from_abbr("", -14400, 1) );
+var_dump( timezone_name_from_abbr("", -14400, 0) );
+
+echo "-- Tests with invalid offsets --\n";
+var_dump( timezone_name_from_abbr("", 5400) ); // offset = 1.5 hrs
+var_dump( timezone_name_from_abbr("", 62400) ); // offset = 24 hrs
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_name_from_abbr() : basic functionality ***
+-- Tests with special cases first - no lookup needed --
+string(3) "UTC"
+string(3) "UTC"
+-- Lookup with just name --
+string(13) "Europe/Berlin"
+string(16) "America/New_York"
+-- Lookup with name and offset--
+string(15) "America/Halifax"
+string(12) "Asia/Baghdad"
+string(11) "Asia/Aqtobe"
+string(11) "Asia/Aqtobe"
+string(11) "Asia/Aqtobe"
+string(17) "America/Boa_Vista"
+string(12) "Asia/Yerevan"
+-- Tests without valid name - uses gmtOffset and isdst to find match --
+string(13) "Europe/London"
+string(17) "America/Sao_Paulo"
+string(16) "America/New_York"
+string(15) "America/Halifax"
+-- Tests with invalid offsets --
+bool(false)
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/timezone_name_from_abbr_error.phpt b/ext/date/tests/timezone_name_from_abbr_error.phpt
new file mode 100644
index 0000000..640caae
--- /dev/null
+++ b/ext/date/tests/timezone_name_from_abbr_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test timezone_name_from_abbr() function : error conditions
+--FILE--
+<?php
+/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] )
+ * Description: Returns the timezone name from abbrevation
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+error_reporting(E_ALL | E_STRICT);
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing timezone_name_from_abbr() : error conditions ***\n";
+
+echo "\n-- Testing timezone_name_from_abbr() function with Zero arguments --\n";
+var_dump( timezone_name_from_abbr() );
+
+echo "\n-- Testing timezone_name_from_abbr() function with more than expected no. of arguments --\n";
+$abbr = 10;
+$gmtOffset = 30;
+$isdst = 45;
+$extra_arg = 10;
+var_dump( timezone_name_from_abbr($abbr, $gmtOffset, $isdst, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_name_from_abbr() : error conditions ***
+
+-- Testing timezone_name_from_abbr() function with Zero arguments --
+
+Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing timezone_name_from_abbr() function with more than expected no. of arguments --
+
+Warning: timezone_name_from_abbr() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/timezone_name_from_abbr_variation1.phpt b/ext/date/tests/timezone_name_from_abbr_variation1.phpt
new file mode 100644
index 0000000..4825d09
--- /dev/null
+++ b/ext/date/tests/timezone_name_from_abbr_variation1.phpt
@@ -0,0 +1,205 @@
+--TEST--
+Test timezone_name_from_abbr() function : usage variation - Passing unexpected values to first argument $abbr.
+--FILE--
+<?php
+/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] )
+ * Description: Returns the timezone name from abbrevation
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing timezone_name_from_abbr() : usage variation - unexpected values to first argument \$abbr***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$gmtOffset= 3600;
+$isdst = 1;
+
+foreach($inputs as $variation =>$abbr) {
+ echo "\n-- $variation --\n";
+ var_dump( timezone_name_from_abbr($abbr, $gmtOffset, $isdst) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_name_from_abbr() : usage variation - unexpected values to first argument $abbr***
+
+-- int 0 --
+string(13) "Europe/London"
+
+-- int 12345 --
+string(13) "Europe/London"
+
+-- int -12345 --
+string(13) "Europe/London"
+
+-- float 10.5 --
+string(13) "Europe/London"
+
+-- float -10.5 --
+string(13) "Europe/London"
+
+-- float .5 --
+string(13) "Europe/London"
+
+-- empty array --
+
+Warning: timezone_name_from_abbr() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: timezone_name_from_abbr() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: timezone_name_from_abbr() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: timezone_name_from_abbr() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+string(13) "Europe/London"
+
+-- lowercase null --
+string(13) "Europe/London"
+
+-- lowercase true --
+string(13) "Europe/London"
+
+-- lowercase false --
+string(13) "Europe/London"
+
+-- uppercase TRUE --
+string(13) "Europe/London"
+
+-- uppercase FALSE --
+string(13) "Europe/London"
+
+-- empty string DQ --
+string(13) "Europe/London"
+
+-- empty string SQ --
+string(13) "Europe/London"
+
+-- string DQ --
+string(13) "Europe/London"
+
+-- string SQ --
+string(13) "Europe/London"
+
+-- mixed case string --
+string(13) "Europe/London"
+
+-- heredoc --
+string(13) "Europe/London"
+
+-- instance of classWithToString --
+string(13) "Europe/London"
+
+-- instance of classWithoutToString --
+
+Warning: timezone_name_from_abbr() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+string(13) "Europe/London"
+
+-- unset var --
+string(13) "Europe/London"
+
+-- resource --
+
+Warning: timezone_name_from_abbr() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_name_from_abbr_variation2.phpt b/ext/date/tests/timezone_name_from_abbr_variation2.phpt
new file mode 100644
index 0000000..0a587a3
--- /dev/null
+++ b/ext/date/tests/timezone_name_from_abbr_variation2.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test timezone_name_from_abbr() function : usage variation - Passing unexpected values to second argument $gmtOffset.
+--FILE--
+<?php
+/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] )
+ * Description: Returns the timezone name from abbrevation
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing timezone_name_from_abbr() : usage variation - unexpected values to second argument \$gmtOffset***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$abbr= "GMT";
+$isdst = 1;
+
+foreach($inputs as $variation =>$gmtOffset) {
+ echo "\n-- $variation --\n";
+ var_dump( timezone_name_from_abbr($abbr, $gmtOffset, $isdst) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_name_from_abbr() : usage variation - unexpected values to second argument $gmtOffset***
+
+-- int 0 --
+string(3) "UTC"
+
+-- int 12345 --
+string(3) "UTC"
+
+-- int -12345 --
+string(3) "UTC"
+
+-- float 10.5 --
+string(3) "UTC"
+
+-- float -10.5 --
+string(3) "UTC"
+
+-- float .5 --
+string(3) "UTC"
+
+-- empty array --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+string(3) "UTC"
+
+-- lowercase null --
+string(3) "UTC"
+
+-- lowercase true --
+string(3) "UTC"
+
+-- lowercase false --
+string(3) "UTC"
+
+-- uppercase TRUE --
+string(3) "UTC"
+
+-- uppercase FALSE --
+string(3) "UTC"
+
+-- empty string DQ --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+string(3) "UTC"
+
+-- unset var --
+string(3) "UTC"
+
+-- resource --
+
+Warning: timezone_name_from_abbr() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_name_from_abbr_variation3.phpt b/ext/date/tests/timezone_name_from_abbr_variation3.phpt
new file mode 100644
index 0000000..66cb210
--- /dev/null
+++ b/ext/date/tests/timezone_name_from_abbr_variation3.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test timezone_name_from_abbr() function : usage variation - Passing unexpected values to third argument $isdst.
+--FILE--
+<?php
+/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] )
+ * Description: Returns the timezone name from abbrevation
+ * Source code: ext/date/php_date.c
+ * Alias to functions:
+ */
+
+echo "*** Testing timezone_name_from_abbr() : usage variation - unexpected values to third argument \$isdst***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$abbr= "GMT";
+$gmtOffset = 3600;
+
+foreach($inputs as $variation =>$isdst) {
+ echo "\n-- $variation --\n";
+ var_dump( timezone_name_from_abbr($abbr, $gmtOffset, $isdst) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_name_from_abbr() : usage variation - unexpected values to third argument $isdst***
+
+-- int 0 --
+string(3) "UTC"
+
+-- int 12345 --
+string(3) "UTC"
+
+-- int -12345 --
+string(3) "UTC"
+
+-- float 10.5 --
+string(3) "UTC"
+
+-- float -10.5 --
+string(3) "UTC"
+
+-- float .5 --
+string(3) "UTC"
+
+-- empty array --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+string(3) "UTC"
+
+-- lowercase null --
+string(3) "UTC"
+
+-- lowercase true --
+string(3) "UTC"
+
+-- lowercase false --
+string(3) "UTC"
+
+-- uppercase TRUE --
+string(3) "UTC"
+
+-- uppercase FALSE --
+string(3) "UTC"
+
+-- empty string DQ --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+string(3) "UTC"
+
+-- unset var --
+string(3) "UTC"
+
+-- resource --
+
+Warning: timezone_name_from_abbr() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_name_get_error.phpt b/ext/date/tests/timezone_name_get_error.phpt
new file mode 100644
index 0000000..3c33e33
--- /dev/null
+++ b/ext/date/tests/timezone_name_get_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test timezone_name_get() function : error conditions
+--FILE--
+<?php
+/* Prototype : string timezone_name_get ( DateTime $object )
+ * Description: Returns the name of the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getName()
+ */
+
+// Set timezone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing timezone_name_get() : error conditions ***\n";
+
+echo "\n-- Testing timezone_name_get() function with zero arguments --\n";
+var_dump( timezone_name_get() );
+
+echo "\n-- Testing date_timezone_set() function with more than expected no. of arguments --\n";
+$datetime = date_create("2009-01-30 17:57:32");
+$extra_arg = 99;
+var_dump( timezone_name_get($datetime, $extra_arg) );
+
+echo "\n-- Testing timezone_name_get() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( timezone_name_get($invalid_obj) );
+$invalid_obj = 10;
+var_dump( timezone_name_get($invalid_obj) );
+$invalid_obj = null;
+var_dump( timezone_name_get($invalid_obj) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_name_get() : error conditions ***
+
+-- Testing timezone_name_get() function with zero arguments --
+
+Warning: timezone_name_get() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing date_timezone_set() function with more than expected no. of arguments --
+
+Warning: timezone_name_get() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing timezone_name_get() function with an invalid values for $object argument --
+
+Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_offset_get_basic1.phpt b/ext/date/tests/timezone_offset_get_basic1.phpt
new file mode 100644
index 0000000..aa658e9
--- /dev/null
+++ b/ext/date/tests/timezone_offset_get_basic1.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test timezone_offset_get() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int timezone_offset_get ( DateTimeZone $object , DateTime $datetime )
+ * Description: Returns the timezone offset from GMT
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getOffset
+ */
+
+echo "*** Testing timezone_offset_get() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+
+$tz = timezone_open("Europe/London");
+$date = date_create("GMT");
+
+var_dump(timezone_offset_get($tz, $date));
+
+$tz = timezone_open("America/New_York");
+var_dump(timezone_offset_get($tz, $date));
+
+$tz = timezone_open("America/Los_Angeles");
+var_dump(timezone_offset_get($tz, $date));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_offset_get() : basic functionality ***
+%rint\(0\)|int\(3600\)%r
+%rint\(-18000\)|int\(-14400\)%r
+%rint\(-28800\)|int\(-25200\)%r
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt
new file mode 100644
index 0000000..b8ca2c1
--- /dev/null
+++ b/ext/date/tests/timezone_offset_get_error.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Test timezone_offset_get() function : error conditions
+--FILE--
+<?php
+/* Prototype : int timezone_offset_get ( DateTimeZone $object , DateTime $datetime )
+ * Description: Returns the timezone offset from GMT
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getOffset
+ */
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+$tz = timezone_open("Europe/London");
+$date = date_create("GMT");
+
+echo "*** Testing timezone_offset_get() : error conditions ***\n";
+
+echo "\n-- Testing timezone_offset_get() function with zero arguments --\n";
+var_dump( timezone_offset_get() );
+
+echo "\n-- Testing timezone_offset_get() function with less than expected no. of arguments --\n";
+var_dump( timezone_offset_get($tz) );
+
+echo "\n-- Testing timezone_offset_get() function with more than expected no. of arguments --\n";
+$extra_arg = 99;
+var_dump( timezone_offset_get($tz, $date, $extra_arg) );
+
+echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( timezone_offset_get($invalid_obj, $date) );
+$invalid_obj = 10;
+var_dump( timezone_offset_get($invalid_obj, $date) );
+$invalid_obj = null;
+var_dump( timezone_offset_get($invalid_obj, $date) );
+
+echo "\n-- Testing timezone_offset_get() function with an invalid values for \$datetime argument --\n";
+$invalid_obj = new stdClass();
+var_dump( timezone_offset_get($tz, $invalid_obj) );
+$invalid_obj = 10;
+var_dump( timezone_offset_get($tz, $invalid_obj) );
+$invalid_obj = null;
+var_dump( timezone_offset_get($tz, $invalid_obj) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_offset_get() : error conditions ***
+
+-- Testing timezone_offset_get() function with zero arguments --
+
+Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+-- Testing timezone_offset_get() function with less than expected no. of arguments --
+
+Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing timezone_offset_get() function with more than expected no. of arguments --
+
+Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+
+-- Testing timezone_offset_get() function with an invalid values for $object argument --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- Testing timezone_offset_get() function with an invalid values for $datetime argument --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d
+bool(false)
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+bool(false)
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_offset_get_variation1.phpt b/ext/date/tests/timezone_offset_get_variation1.phpt
new file mode 100644
index 0000000..5fd5e8b
--- /dev/null
+++ b/ext/date/tests/timezone_offset_get_variation1.phpt
@@ -0,0 +1,252 @@
+--TEST--
+Test timezone_offset_get() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : int timezone_offset_get ( DateTimeZone $object , DateTime $datetime )
+ * Description: Returns the timezone offset from GMT
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getOffset()
+ */
+
+echo "*** Testing timezone_offset_get() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$datetime = new DateTime("2009-01-31 15:14:10");
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( timezone_offset_get($object, $datetime) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_offset_get() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_offset_get_variation2.phpt b/ext/date/tests/timezone_offset_get_variation2.phpt
new file mode 100644
index 0000000..93311f3
--- /dev/null
+++ b/ext/date/tests/timezone_offset_get_variation2.phpt
@@ -0,0 +1,252 @@
+--TEST--
+Test timezone_offset_get() function : usage variation - Passing unexpected values to second argument $datetime.
+--FILE--
+<?php
+/* Prototype : int timezone_offset_get ( DateTimeZone $object , DateTime $datetime )
+ * Description: Returns the timezone offset from GMT
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getOffset()
+ */
+
+echo "*** Testing timezone_offset_get() : usage variation - unexpected values to second argument \$datetime***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$object = new DateTimezone("Europe/London");
+
+foreach($inputs as $variation =>$datetime) {
+ echo "\n-- $variation --\n";
+ var_dump( timezone_offset_get($object, $datetime) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_offset_get() : usage variation - unexpected values to second argument $datetime***
+
+-- int 0 --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: timezone_offset_get() expects parameter 2 to be DateTime, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_open_basic1.phpt b/ext/date/tests/timezone_open_basic1.phpt
new file mode 100644
index 0000000..7a98936
--- /dev/null
+++ b/ext/date/tests/timezone_open_basic1.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test timezone_open() function : basic functionality
+--FILE--
+<?php
+/* Prototype : DateTimeZone timezone_open ( string $timezone )
+ * Description: Returns new DateTimeZone object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::__construct()
+ */
+
+echo "*** Testing timezone_open() : basic functionality ***\n";
+
+var_dump( timezone_open("GMT") );
+var_dump( timezone_open("Europe/London") );
+var_dump( timezone_open("America/Los_Angeles") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_open() : basic functionality ***
+object(DateTimeZone)#%d (0) {
+}
+object(DateTimeZone)#%d (0) {
+}
+object(DateTimeZone)#%d (0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/timezone_open_error.phpt b/ext/date/tests/timezone_open_error.phpt
new file mode 100644
index 0000000..16c5f0b
--- /dev/null
+++ b/ext/date/tests/timezone_open_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test timezone_open() function : error conditions
+--FILE--
+<?php
+/* Prototype : DateTimeZone timezone_open ( string $timezone )
+ * Description: Returns new DateTimeZone object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::__construct()
+ */
+
+echo "*** Testing timezone_open() : error conditions ***\n";
+
+echo "\n-- Testing timezone_open() function with zero arguments --\n";
+var_dump( timezone_open() );
+
+echo "\n-- Testing timezone_open() function with more than expected no. of arguments --\n";
+$time = "GMT";
+$extra_arg = 99;
+var_dump( timezone_open($time, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_open() : error conditions ***
+
+-- Testing timezone_open() function with zero arguments --
+
+Warning: timezone_open() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing timezone_open() function with more than expected no. of arguments --
+
+Warning: timezone_open() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_open_variation1.phpt b/ext/date/tests/timezone_open_variation1.phpt
new file mode 100644
index 0000000..9a069f6
--- /dev/null
+++ b/ext/date/tests/timezone_open_variation1.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test timezone_open function : usage variation - Passing unexpected values to first argument $timezone.
+--FILE--
+<?php
+/* Prototype : DateTimeZone timezone_open ( string $timezone )
+ * Description: Returns new DateTimeZone object
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTime::__construct()
+ */
+
+echo "*** Testing timezone_open() : usage variation - unexpected values to first argument \$timezone***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+foreach($inputs as $variation =>$timezone) {
+ echo "\n-- $variation --\n";
+ var_dump( timezone_open($timezone) );
+
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_open() : usage variation - unexpected values to first argument $timezone***
+
+-- int 0 --
+
+Warning: timezone_open(): Unknown or bad timezone (0) in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: timezone_open(): Unknown or bad timezone (1) in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: timezone_open(): Unknown or bad timezone (12345) in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: timezone_open(): Unknown or bad timezone (-12345) in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: timezone_open(): Unknown or bad timezone (10.5) in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: timezone_open(): Unknown or bad timezone (-10.5) in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: timezone_open(): Unknown or bad timezone (0.5) in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: timezone_open() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: timezone_open() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: timezone_open() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: timezone_open() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: timezone_open(): Unknown or bad timezone () in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: timezone_open(): Unknown or bad timezone () in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: timezone_open(): Unknown or bad timezone (1) in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: timezone_open(): Unknown or bad timezone () in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: timezone_open(): Unknown or bad timezone (1) in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: timezone_open(): Unknown or bad timezone () in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: timezone_open(): Unknown or bad timezone () in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: timezone_open(): Unknown or bad timezone () in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: timezone_open(): Unknown or bad timezone (string) in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: timezone_open(): Unknown or bad timezone (string) in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: timezone_open(): Unknown or bad timezone (sTrInG) in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: timezone_open(): Unknown or bad timezone (hello world) in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: timezone_open(): Unknown or bad timezone (Class A object) in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: timezone_open() expects parameter 1 to be string, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: timezone_open(): Unknown or bad timezone () in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: timezone_open(): Unknown or bad timezone () in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: timezone_open() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_transitions_get_basic1.phpt b/ext/date/tests/timezone_transitions_get_basic1.phpt
new file mode 100644
index 0000000..eb6cf99
--- /dev/null
+++ b/ext/date/tests/timezone_transitions_get_basic1.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test timezone_transitions_get() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] )
+ * Description: Returns all transitions for the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getTransitions()
+ */
+
+echo "*** Testing timezone_transitions_get() : basic functionality ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+// Create a DateTimeZone object
+$tz = timezone_open("Europe/London");
+
+$tran = timezone_transitions_get($tz);
+
+echo "\n-- Get all transitions --\n";
+$tran = timezone_transitions_get($tz);
+var_dump( gettype($tran) );
+
+echo "\n-- Total number of transitions: " . count($tran). " --\n";
+
+echo "\n-- Format a sample entry pfor Spring 1963 --\n";
+var_dump( $tran[97] );
+
+?>
+===DONE===
+--EXPECT--
+*** Testing timezone_transitions_get() : basic functionality ***
+
+-- Get all transitions --
+string(5) "array"
+
+-- Total number of transitions: 243 --
+
+-- Format a sample entry pfor Spring 1963 --
+array(5) {
+ ["ts"]=>
+ int(-213228000)
+ ["time"]=>
+ string(24) "1963-03-31T02:00:00+0000"
+ ["offset"]=>
+ int(3600)
+ ["isdst"]=>
+ bool(true)
+ ["abbr"]=>
+ string(3) "BST"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/date/tests/timezone_transitions_get_error.phpt b/ext/date/tests/timezone_transitions_get_error.phpt
new file mode 100644
index 0000000..142cfda
--- /dev/null
+++ b/ext/date/tests/timezone_transitions_get_error.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test timezone_transitions_get() function : error conditions
+--FILE--
+<?php
+/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] )
+ * Description: Returns all transitions for the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getTransitions()
+ */
+
+//Set the default time zone
+date_default_timezone_set("GMT");
+$tz = timezone_open("Europe/London");
+
+echo "*** Testing timezone_transitions_get() : error conditions ***\n";
+
+echo "\n-- Testing timezone_transitions_get() function with zero arguments --\n";
+var_dump( timezone_transitions_get() );
+
+echo "\n-- Testing timezone_transitions_get() function with more than expected no. of arguments --\n";
+$timestamp_begin = mktime(0, 0, 0, 1, 1, 1972);
+$timestamp_end = mktime(0, 0, 0, 1, 1, 1975);
+$extra_arg = 99;
+var_dump( timezone_transitions_get($tz, $timestamp_begin, $timestamp_end, $extra_arg) );
+
+echo "\n-- Testing timezone_transitions_get() function with an invalid values for \$object argument --\n";
+$invalid_obj = new stdClass();
+var_dump( timezone_transitions_get($invalid_obj) );
+$invalid_obj = 10;
+var_dump( timezone_transitions_get($invalid_obj) );
+$invalid_obj = null;
+var_dump( timezone_transitions_get($invalid_obj) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_transitions_get() : error conditions ***
+
+-- Testing timezone_transitions_get() function with zero arguments --
+
+Warning: timezone_transitions_get() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing timezone_transitions_get() function with more than expected no. of arguments --
+
+Warning: timezone_transitions_get() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+-- Testing timezone_transitions_get() function with an invalid values for $object argument --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_transitions_get_variation1.phpt b/ext/date/tests/timezone_transitions_get_variation1.phpt
new file mode 100644
index 0000000..62159dd
--- /dev/null
+++ b/ext/date/tests/timezone_transitions_get_variation1.phpt
@@ -0,0 +1,250 @@
+--TEST--
+Test timezone_transitions_get() function : usage variation - Passing unexpected values to first argument $object.
+--FILE--
+<?php
+/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] )
+ * Description: Returns all transitions for the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getTransitions()
+ */
+
+echo "*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument \$object***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+foreach($inputs as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump( timezone_transitions_get($object) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument $object***
+
+-- int 0 --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 1 --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int 12345 --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- int -12345 --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+bool(false)
+
+-- float 10.5 --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float -10.5 --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- float .5 --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+bool(false)
+
+-- empty array --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- int indexed array --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- associative array --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- nested arrays --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+bool(false)
+
+-- uppercase NULL --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- lowercase null --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- lowercase true --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- lowercase false --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase TRUE --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- uppercase FALSE --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+bool(false)
+
+-- empty string DQ --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- empty string SQ --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string DQ --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- string SQ --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- mixed case string --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- heredoc --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+bool(false)
+
+-- instance of classWithToString --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- instance of classWithoutToString --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+bool(false)
+
+-- undefined var --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- unset var --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+bool(false)
+
+-- resource --
+
+Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/date/tests/timezone_transitions_get_variation2.phpt b/ext/date/tests/timezone_transitions_get_variation2.phpt
new file mode 100644
index 0000000..bc5fa85
--- /dev/null
+++ b/ext/date/tests/timezone_transitions_get_variation2.phpt
@@ -0,0 +1,253 @@
+--TEST--
+Test timezone_transitions_get() function : usage variation - Passing unexpected values to first argument $timestamp_begin.
+--FILE--
+<?php
+/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] )
+ * Description: Returns all transitions for the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getTransitions()
+ */
+
+echo "*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument \$timestamp_begin ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$tz = timezone_open("Europe/London");
+$timestamp_end = mktime(0, 0, 0, 1, 1, 1975);
+
+foreach($inputs as $variation =>$timestamp_begin) {
+ echo "\n-- $variation --\n";
+ $tran = timezone_transitions_get($tz, $timestamp_begin, $timestamp_end);
+ var_dump( gettype($tran) );
+ var_dump( count($tran) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument $timestamp_begin ***
+
+-- int 0 --
+string(5) "array"
+int(8)
+
+-- int 1 --
+string(5) "array"
+int(8)
+
+-- int 12345 --
+string(5) "array"
+int(8)
+
+-- int -12345 --
+string(5) "array"
+int(8)
+
+-- float 10.5 --
+string(5) "array"
+int(8)
+
+-- float -10.5 --
+string(5) "array"
+int(8)
+
+-- float .5 --
+string(5) "array"
+int(8)
+
+-- empty array --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, array given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- int indexed array --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, array given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- associative array --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, array given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- nested arrays --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, array given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- uppercase NULL --
+string(5) "array"
+int(8)
+
+-- lowercase null --
+string(5) "array"
+int(8)
+
+-- lowercase true --
+string(5) "array"
+int(8)
+
+-- lowercase false --
+string(5) "array"
+int(8)
+
+-- uppercase TRUE --
+string(5) "array"
+int(8)
+
+-- uppercase FALSE --
+string(5) "array"
+int(8)
+
+-- empty string DQ --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- empty string SQ --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- string DQ --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- string SQ --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- mixed case string --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- heredoc --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- instance of classWithToString --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, object given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- instance of classWithoutToString --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, object given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- undefined var --
+string(5) "array"
+int(8)
+
+-- unset var --
+string(5) "array"
+int(8)
+
+-- resource --
+
+Warning: timezone_transitions_get() expects parameter 2 to be long, resource given in %s on line %d
+string(7) "boolean"
+int(1)
+===DONE===
diff --git a/ext/date/tests/timezone_transitions_get_variation3.phpt b/ext/date/tests/timezone_transitions_get_variation3.phpt
new file mode 100644
index 0000000..0112a2f
--- /dev/null
+++ b/ext/date/tests/timezone_transitions_get_variation3.phpt
@@ -0,0 +1,253 @@
+--TEST--
+Test timezone_transitions_get() function : usage variation - Passing unexpected values to first argument $timestamp_env.
+--FILE--
+<?php
+/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] )
+ * Description: Returns all transitions for the timezone
+ * Source code: ext/date/php_date.c
+ * Alias to functions: DateTimeZone::getTransitions()
+ */
+
+echo "*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument \$timestamp_end ***\n";
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -12345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource
+ 'resource' => $file_handle
+);
+
+$tz = timezone_open("Europe/London");
+$timestamp_begin = mktime(0, 0, 0, 1, 1, 1975);
+
+foreach($inputs as $variation =>$timestamp_end) {
+ echo "\n-- $variation --\n";
+ $tran = timezone_transitions_get($tz, $timestamp_begin, $timestamp_end);
+ var_dump( gettype($tran) );
+ var_dump( count($tran) );
+};
+
+// closing the resource
+fclose( $file_handle );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument $timestamp_end ***
+
+-- int 0 --
+string(5) "array"
+int(1)
+
+-- int 1 --
+string(5) "array"
+int(1)
+
+-- int 12345 --
+string(5) "array"
+int(1)
+
+-- int -12345 --
+string(5) "array"
+int(1)
+
+-- float 10.5 --
+string(5) "array"
+int(1)
+
+-- float -10.5 --
+string(5) "array"
+int(1)
+
+-- float .5 --
+string(5) "array"
+int(1)
+
+-- empty array --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, array given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- int indexed array --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, array given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- associative array --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, array given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- nested arrays --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, array given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- uppercase NULL --
+string(5) "array"
+int(1)
+
+-- lowercase null --
+string(5) "array"
+int(1)
+
+-- lowercase true --
+string(5) "array"
+int(1)
+
+-- lowercase false --
+string(5) "array"
+int(1)
+
+-- uppercase TRUE --
+string(5) "array"
+int(1)
+
+-- uppercase FALSE --
+string(5) "array"
+int(1)
+
+-- empty string DQ --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- empty string SQ --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- string DQ --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- string SQ --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- mixed case string --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- heredoc --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, string given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- instance of classWithToString --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, object given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- instance of classWithoutToString --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, object given in %s on line %d
+string(7) "boolean"
+int(1)
+
+-- undefined var --
+string(5) "array"
+int(1)
+
+-- unset var --
+string(5) "array"
+int(1)
+
+-- resource --
+
+Warning: timezone_transitions_get() expects parameter 3 to be long, resource given in %s on line %d
+string(7) "boolean"
+int(1)
+===DONE===
diff --git a/ext/date/tests/timezones-list.phpt b/ext/date/tests/timezones-list.phpt
new file mode 100644
index 0000000..5998498
--- /dev/null
+++ b/ext/date/tests/timezones-list.phpt
@@ -0,0 +1,49 @@
+--TEST--
+timezone_identifiers_list()
+--FILE--
+<?php
+$a = timezone_identifiers_list();
+$b = timezone_identifiers_list( DateTimezone::AMERICA );
+$c = timezone_identifiers_list( DateTimezone::ALL_WITH_BC );
+$d = timezone_identifiers_list( DateTimezone::EUROPE | DateTimezone::UTC );
+
+echo in_array( "Europe/Oslo", $a ) ? "found" : "notfound", "\n";
+echo in_array( "Europe/Oslo", $b ) ? "found" : "notfound", "\n";
+echo in_array( "Europe/Oslo", $c ) ? "found" : "notfound", "\n";
+echo in_array( "Europe/Oslo", $d ) ? "found" : "notfound", "\n\n";
+
+echo in_array( "America/New_York", $a ) ? "found" : "notfound", "\n";
+echo in_array( "America/New_York", $b ) ? "found" : "notfound", "\n";
+echo in_array( "America/New_York", $c ) ? "found" : "notfound", "\n";
+echo in_array( "America/New_York", $d ) ? "found" : "notfound", "\n\n";
+
+echo in_array( "UTC", $a ) ? "found" : "notfound", "\n";
+echo in_array( "UTC", $b ) ? "found" : "notfound", "\n";
+echo in_array( "UTC", $c ) ? "found" : "notfound", "\n";
+echo in_array( "UTC", $d ) ? "found" : "notfound", "\n\n";
+
+echo in_array( "US/Eastern", $a ) ? "found" : "notfound", "\n";
+echo in_array( "US/Eastern", $b ) ? "found" : "notfound", "\n";
+echo in_array( "US/Eastern", $c ) ? "found" : "notfound", "\n";
+echo in_array( "US/Eastern", $d ) ? "found" : "notfound", "\n\n";
+?>
+--EXPECT--
+found
+notfound
+found
+found
+
+found
+found
+found
+notfound
+
+found
+notfound
+found
+found
+
+notfound
+notfound
+found
+notfound
diff --git a/ext/date/tests/timezones.phpt b/ext/date/tests/timezones.phpt
new file mode 100644
index 0000000..c7e470a
--- /dev/null
+++ b/ext/date/tests/timezones.phpt
@@ -0,0 +1,26 @@
+--TEST--
+setting bogus timezones
+--FILE--
+<?php
+
+//bogus
+var_dump(date_default_timezone_set('AAA'));
+var_dump(date_default_timezone_set('ZZZ'));
+
+
+//now the first and the last one
+var_dump(date_default_timezone_set("Africa/Abidjan"));
+var_dump(date_default_timezone_set("Zulu"));
+
+echo "done\n";
+
+?>
+--EXPECTF--
+Notice: date_default_timezone_set(): Timezone ID 'AAA' is invalid in %stimezones.php on line 4
+bool(false)
+
+Notice: date_default_timezone_set(): Timezone ID 'ZZZ' is invalid in %stimezones.php on line 5
+bool(false)
+bool(true)
+bool(true)
+done