cvs: pecl(PHP_5_2) /intl/dateformat dateformat_format.c dateformat_parse.c /intl/tests dateformat_format.phpt dateformat_localtime.phpt
dateformat_parse.phpt dateformat_parse_localtime_parsepos.phpt dateformat_parse_timestamp_parsepos.phpt
| From: | Kirti Velankar | Date: | Fri, 21 Mar 2008 23:59:29 +0000 |
| Subject: | cvs: pecl(PHP_5_2) /intl/dateformat dateformat_format.c dateformat_parse.c /intl/tests dateformat_format.phpt dateformat_localtime.phpt dateformat_parse.phpt dateformat_parse_localtime_parsepos.phpt dateformat_parse_timestamp_parsepos.phpt |
||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-10003@lists.php.net to get a copy of this message | ||
kirtig Fri Mar 21 23:59:29 2008 UTC
Modified files: (Branch: PHP_5_2)
/pecl/intl/dateformat dateformat_format.c dateformat_parse.c
/pecl/intl/tests dateformat_format.phpt dateformat_localtime.phpt
dateformat_parse.phpt
dateformat_parse_localtime_parsepos.phpt
dateformat_parse_timestamp_parsepos.phpt
Log:
Fixed format and parse for long and double values
http://cvs.php.net/viewvc.cgi/pecl/intl/dateformat/dateformat_format.c?r1=1.1.2.5&r2=1.1.2.6&diff_format=u Index: pecl/intl/dateformat/dateformat_format.c diff -u pecl/intl/dateformat/dateformat_format.c:1.1.2.5 pecl/intl/dateformat/dateformat_format.c:1.1.2.6 --- pecl/intl/dateformat/dateformat_format.c:1.1.2.5 Thu Mar 6 19:54:43 2008 +++ pecl/intl/dateformat/dateformat_format.c Fri Mar 21 23:59:28 2008 @@ -31,10 +31,10 @@ /* {{{ * Internal function which calls the udat_format */ -static void internal_format(DateFormatter_object *mfo, double timestamp , zval *return_value TSRMLS_DC){ +static void internal_format(DateFormatter_object *mfo, UDate timestamp , zval *return_value TSRMLS_DC){ UChar* formatted = NULL; - int resultlengthneeded =0 ; - + int32_t resultlengthneeded =0 ; + resultlengthneeded=udat_format( DATE_FORMAT_OBJECT(mfo), timestamp, NULL, resultlengthneeded, NULL, &INTL_DATA_ERROR_CODE(mfo)); if(INTL_DATA_ERROR_CODE(mfo)==U_BUFFER_OVERFLOW_ERROR) { @@ -89,7 +89,7 @@ UBool isInDST = FALSE; //Fetch values from the incoming array - year = internal_get_arr_ele( mfo , hash_arr , CALENDAR_YEAR TSRMLS_CC); + year = internal_get_arr_ele( mfo , hash_arr , CALENDAR_YEAR TSRMLS_CC) + 1900; //tm_year is years since 1900 month = internal_get_arr_ele( mfo , hash_arr , CALENDAR_MON TSRMLS_CC); hour = internal_get_arr_ele( mfo , hash_arr , CALENDAR_HOUR TSRMLS_CC); minute = internal_get_arr_ele( mfo , hash_arr , CALENDAR_MIN TSRMLS_CC); @@ -118,7 +118,8 @@ * Format the time value as a string. }}}*/ PHP_FUNCTION(datefmt_format) { - double timestamp =0; + UDate timestamp =0; + UDate p_timestamp =0; UCalendar* temp_cal ; HashTable* hash_arr = NULL; zval* zarg = NULL; @@ -140,10 +141,13 @@ switch(Z_TYPE_P(zarg) ){ case IS_LONG: - //Purposely fallthrough + p_timestamp = Z_LVAL_P(zarg) ; + timestamp = p_timestamp * 1000; + break; case IS_DOUBLE: //timestamp*1000 since ICU expects it in milliseconds - timestamp = (Z_LVAL_P(zarg) * 1000); + p_timestamp = Z_DVAL_P(zarg) ; + timestamp = p_timestamp * 1000; break; case IS_ARRAY: hash_arr = Z_ARRVAL_P(zarg); @@ -165,7 +169,7 @@ */ default: intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_format: takes either an array or a DateTime object or an integer TimeStamp value ", 0 TSRMLS_CC ); + "datefmt_format: takes either an array or an integer TimeStamp value ", 0 TSRMLS_CC ); RETURN_FALSE; } http://cvs.php.net/viewvc.cgi/pecl/intl/dateformat/dateformat_parse.c?r1=1.1.2.5&r2=1.1.2.6&diff_format=u Index: pecl/intl/dateformat/dateformat_parse.c diff -u pecl/intl/dateformat/dateformat_parse.c:1.1.2.5 pecl/intl/dateformat/dateformat_parse.c:1.1.2.6 --- pecl/intl/dateformat/dateformat_parse.c:1.1.2.5 Thu Mar 13 18:20:10 2008 +++ pecl/intl/dateformat/dateformat_parse.c Fri Mar 21 23:59:28 2008 @@ -39,8 +39,8 @@ * if set to 0 - no need to store any error encountered in the parameter parse_error */ static void internal_parse_to_timestamp(DateFormatter_object *mfo, char* text_to_parse , int text_len, int parse_pos , zval *return_value TSRMLS_DC){ - - int32_t timestamp =0; + long int result = 0; + UDate timestamp =0; UChar* text_utf16 = NULL; int32_t text_utf16_len = 0; @@ -48,23 +48,32 @@ intl_convert_utf8_to_utf16(&text_utf16 , &text_utf16_len , text_to_parse , text_len, &INTL_DATA_ERROR_CODE(mfo)); INTL_METHOD_CHECK_STATUS(mfo, "Error converting timezone to UTF-16" ); - timestamp = udat_parse( DATE_FORMAT_OBJECT(mfo), text_utf16 , text_utf16_len , &parse_pos , &INTL_DATA_ERROR_CODE(mfo)); if( text_utf16 ){ efree(text_utf16); } INTL_METHOD_CHECK_STATUS( mfo, "Date parsing failed" ); - + //Since return is in sec. - RETURN_LONG( timestamp / 1000 ); + result = (long int)( timestamp / 1000 ); + if( result != (timestamp/1000) ) { + intl_error_set( NULL, U_BUFFER_OVERFLOW_ERROR, + "datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle.\nThe valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.", 0 TSRMLS_CC ); + } + RETURN_LONG( result ); } /* }}} */ static void add_to_localtime_arr( DateFormatter_object *mfo, zval* return_value ,UCalendar parsed_calendar , int32_t calendar_field , char* key_name TSRMLS_DC){ int calendar_field_val = ucal_get( parsed_calendar , calendar_field , &INTL_DATA_ERROR_CODE(mfo)); INTL_METHOD_CHECK_STATUS( mfo, "Date parsing - localtime failed : could not get a field from calendar" ); - add_assoc_long( return_value, key_name , calendar_field_val ); + if( strcmp(key_name , CALENDAR_YEAR )==0 ){ + //since tm_year is years from 1900 + add_assoc_long( return_value, key_name ,( calendar_field_val-1900) ); + }else{ + add_assoc_long( return_value, key_name , calendar_field_val ); + } } /* {{{ @@ -97,7 +106,7 @@ add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_SECOND , CALENDAR_SEC TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_MINUTE , CALENDAR_MIN TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_HOUR_OF_DAY , CALENDAR_HOUR TSRMLS_CC); - add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_YEAR , CALENDAR_YEAR TSRMLS_CC); + add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_YEAR , CALENDAR_YEAR TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_MONTH , CALENDAR_MDAY TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_WEEK , CALENDAR_WDAY TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_YEAR , CALENDAR_YDAY TSRMLS_CC); http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_format.phpt?r1=1.1.2.5&r2=1.1.2.6&diff_format=u Index: pecl/intl/tests/dateformat_format.phpt diff -u pecl/intl/tests/dateformat_format.phpt:1.1.2.5 pecl/intl/tests/dateformat_format.phpt:1.1.2.6 --- pecl/intl/tests/dateformat_format.phpt:1.1.2.5 Thu Mar 13 18:20:10 2008 +++ pecl/intl/tests/dateformat_format.phpt Fri Mar 21 23:59:28 2008 @@ -33,6 +33,7 @@ 1200000, 2200000000, -2200000000, + 90099999, 3600, -3600 ); @@ -192,30 +193,45 @@ ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted timestamp is : Wednesday, December 31, 1969 4:00:00 PM PT +Formatted timestamp is : Sunday, September 18, 2039 4:06:40 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted timestamp is : December 31, 1969 4:00:00 PM PST +Formatted timestamp is : September 18, 2039 4:06:40 PM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted timestamp is : Dec 31, 1969 4:00:00 PM +Formatted timestamp is : Sep 18, 2039 4:06:40 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 -Formatted timestamp is : 12/31/69 4:00 PM +Formatted timestamp is : 9/18/39 4:06 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted timestamp is : 19691231 04:00 PM +Formatted timestamp is : 20390918 04:06 PM ------------ Input timestamp is : -2200000000 ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted timestamp is : Wednesday, December 31, 1969 4:00:00 PM PT +Formatted timestamp is : Saturday, April 14, 1900 5:53:20 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted timestamp is : December 31, 1969 4:00:00 PM PST +Formatted timestamp is : April 14, 1900 5:53:20 PM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted timestamp is : Dec 31, 1969 4:00:00 PM +Formatted timestamp is : Apr 14, 1900 5:53:20 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 -Formatted timestamp is : 12/31/69 4:00 PM +Formatted timestamp is : 4/14/00 5:53 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted timestamp is : 19691231 04:00 PM +Formatted timestamp is : 19000414 05:53 PM +------------ + +Input timestamp is : 90099999 +------------ + +DateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, November 8, 1972 11:46:39 AM PT +DateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : November 8, 1972 11:46:39 AM PST +DateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Nov 8, 1972 11:46:39 AM +DateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 11/8/72 11:46 AM +DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19721108 11:46 AM ------------ Input timestamp is : 3600 @@ -252,57 +268,57 @@ ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted localtime_array is : Thursday, April 3, 0105 7:03:24 PM PT +Formatted localtime_array is : Sunday, April 3, 2005 7:03:24 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted localtime_array is : April 3, 0105 7:03:24 PM PDT +Formatted localtime_array is : April 3, 2005 7:03:24 PM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted localtime_array is : Apr 3, 0105 7:03:24 PM +Formatted localtime_array is : Apr 3, 2005 7:03:24 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 4/3/05 7:03 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted localtime_array is : 01050403 07:03 PM +Formatted localtime_array is : 20050403 07:03 PM ------------ Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '3' , tm_mday : '3' , tm_mon : '3' , tm_year : '205' , tm_wday : '0' , tm_yday : '92' , tm_isdst : '1' , ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted localtime_array is : Wednesday, April 3, 0205 3:03:24 AM PT +Formatted localtime_array is : Friday, April 3, 2105 3:03:24 AM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted localtime_array is : April 3, 0205 3:03:24 AM PDT +Formatted localtime_array is : April 3, 2105 3:03:24 AM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted localtime_array is : Apr 3, 0205 3:03:24 AM +Formatted localtime_array is : Apr 3, 2105 3:03:24 AM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 4/3/05 3:03 AM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted localtime_array is : 02050403 03:03 AM +Formatted localtime_array is : 21050403 03:03 AM ------------ Input localtime is : tm_sec : '0' , tm_min : '0' , tm_hour : '5' , tm_mday : '12' , tm_mon : '12' , tm_year : '205' , tm_wday : '0' , tm_yday : '92' , tm_isdst : '1' , ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted localtime_array is : Sunday, January 12, 0206 5:00:00 AM PT +Formatted localtime_array is : Tuesday, January 12, 2106 5:00:00 AM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted localtime_array is : January 12, 0206 5:00:00 AM PDT +Formatted localtime_array is : January 12, 2106 5:00:00 AM PST DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted localtime_array is : Jan 12, 0206 5:00:00 AM +Formatted localtime_array is : Jan 12, 2106 5:00:00 AM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 1/12/06 5:00 AM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted localtime_array is : 02060112 05:00 AM +Formatted localtime_array is : 21060112 05:00 AM ------------ Input localtime is : tm_sec : '0' , tm_min : '0' , tm_hour : '21' , tm_mday : '12' , tm_mon : '12' , tm_year : '205' , tm_wday : '0' , tm_yday : '92' , tm_isdst : '1' , ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted localtime_array is : Sunday, January 12, 0206 9:00:00 PM PT +Formatted localtime_array is : Tuesday, January 12, 2106 9:00:00 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted localtime_array is : January 12, 0206 9:00:00 PM PDT +Formatted localtime_array is : January 12, 2106 9:00:00 PM PST DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted localtime_array is : Jan 12, 0206 9:00:00 PM +Formatted localtime_array is : Jan 12, 2106 9:00:00 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 1/12/06 9:00 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted localtime_array is : 02060112 09:00 PM \ No newline at end of file +Formatted localtime_array is : 21060112 09:00 PM http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_localtime.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: pecl/intl/tests/dateformat_localtime.phpt diff -u pecl/intl/tests/dateformat_localtime.phpt:1.1.2.3 pecl/intl/tests/dateformat_localtime.phpt:1.1.2.4 --- pecl/intl/tests/dateformat_localtime.phpt:1.1.2.3 Thu Mar 13 18:20:10 2008 +++ pecl/intl/tests/dateformat_localtime.phpt Fri Mar 21 23:59:28 2008 @@ -105,7 +105,7 @@ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM ------------ DateFormatter : DateType::FULL, TimeType::FULL -tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '1969' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , +tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '69' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , ------------------------------- Input text is : Thursday, December 18, 1969 8:49:59 PM PST @@ -119,7 +119,7 @@ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM ------------ DateFormatter : DateType::FULL, TimeType::FULL -tm_sec : '59' , tm_min : '49' , tm_hour : '20' , tm_year : '1969' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , +tm_sec : '59' , tm_min : '49' , tm_hour : '20' , tm_year : '69' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , ------------------------------- Input text is : June 18, 1969 8:49:59 AM PST @@ -129,10 +129,10 @@ DateFormatter : DateType::NONE, TimeType::NONE ------------ DateFormatter : DateType::LONG, TimeType::LONG -tm_sec : '59' , tm_min : '49' , tm_hour : '9' , tm_year : '1969' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , +tm_sec : '59' , tm_min : '49' , tm_hour : '9' , tm_year : '69' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , ------------ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM -tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '1969' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , +tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '69' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , ------------ DateFormatter : DateType::FULL, TimeType::FULL ------------------------------- http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_parse.phpt?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: pecl/intl/tests/dateformat_parse.phpt diff -u pecl/intl/tests/dateformat_parse.phpt:1.1.2.4 pecl/intl/tests/dateformat_parse.phpt:1.1.2.5 --- pecl/intl/tests/dateformat_parse.phpt:1.1.2.4 Thu Mar 13 18:20:10 2008 +++ pecl/intl/tests/dateformat_parse.phpt Fri Mar 21 23:59:28 2008 @@ -28,6 +28,7 @@ $text_arr = array ( + "Sunday, September 18, 2039 4:06:40 PM PT", "Thursday, December 18, 1969 8:49:59 AM PST", "Thursday, December 18, 1969 8:49:59 PM PST", "December 18, 1969 8:49:59 AM PST", @@ -63,6 +64,8 @@ ut_run(); ?> --EXPECT-- +Input text :Sunday, September 18, 2039 4:06:40 PM PT ; Parsed text : 96000 ; parse_pos : 29 +Input text :Sunday, September 18, 2039 4:06:40 PM PT ; Parsed text : 96000 ; parse_pos : 30 Input text :Thursday, December 18, 1969 8:49:59 AM PST ; Parsed text : 208740 ; parse_pos : 30 Input text :Thursday, December 18, 1969 8:49:59 AM PST ; Parsed text : 64740 ; parse_pos : 31 Input text :Thursday, December 18, 1969 8:49:59 PM PST ; Parsed text : 251940 ; parse_pos : 30 @@ -73,4 +76,4 @@ Input text :12/18/69 8:49 AM ; Parsed text : 60540 ; parse_pos : 9 Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 8 Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 9 -Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 10 +Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 10 \ No newline at end of file http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt diff -u pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt:1.1.2.1 pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt:1.1.2.2 --- pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt:1.1.2.1 Thu Mar 6 20:04:30 2008 +++ pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt Fri Mar 21 23:59:28 2008 @@ -98,7 +98,7 @@ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM Error : 'Date parsing failed: U_PARSE_ERROR' ------------ DateFormatter : DateType::FULL, TimeType::FULL -tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '1969' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , +tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '69' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , ------------------------------- Input text is : June 18, 1969 8:49:59 AM PST @@ -108,10 +108,10 @@ DateFormatter : DateType::NONE, TimeType::NONE Error : 'Date parsing failed: U_PARSE_ERROR' ------------ DateFormatter : DateType::LONG, TimeType::LONG -tm_sec : '59' , tm_min : '49' , tm_hour : '9' , tm_year : '1969' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , +tm_sec : '59' , tm_min : '49' , tm_hour : '9' , tm_year : '69' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , ------------ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM -tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '1969' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , +tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '69' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , ------------ DateFormatter : DateType::FULL, TimeType::FULL Error : 'Date parsing failed: U_PARSE_ERROR' ------------------------------- http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt diff -u pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt:1.1.2.1 pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt:1.1.2.2 --- pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt:1.1.2.1 Thu Mar 6 20:04:30 2008 +++ pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt Fri Mar 21 23:59:28 2008 @@ -28,9 +28,11 @@ $text_arr = array ( + "Sunday, September 18, 3039 4:06:40 PM PT", "Thursday, December 18, 1969 8:49:59 AM PST", - "December 18, 1969 8:49:59 AM PST", - "12/18/69 8:49 AM", + //"December 18, 1969 8:49:59 AM PST", + //"12/18/69 8:49 AM", + "19001218 08:49 AM", "19691218 08:49 AM" ); @@ -69,12 +71,13 @@ --EXPECT-- ------------ -Input text is : Thursday, December 18, 1969 8:49:59 AM PST +Input text is : Sunday, September 18, 3039 4:06:40 PM PT ------------ Locale is : en_US_CA ------------ datetype = 0 ,timetype =0 -Parsed text is : -1149001 +Error while parsing as: 'datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle. +The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.: U_BUFFER_OVERFLOW_ERROR' datetype = 1 ,timetype =1 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = 2 ,timetype =2 @@ -85,23 +88,23 @@ Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' ------------ -Input text is : December 18, 1969 8:49:59 AM PST +Input text is : Thursday, December 18, 1969 8:49:59 AM PST ------------ Locale is : en_US_CA ------------ datetype = 0 ,timetype =0 -Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' -datetype = 1 ,timetype =1 Parsed text is : -1149001 +datetype = 1 ,timetype =1 +Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = 2 ,timetype =2 -Parsed text is : -1149001 +Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = 3 ,timetype =3 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = -1 ,timetype =-1 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' ------------ -Input text is : 12/18/69 8:49 AM +Input text is : 19001218 08:49 AM ------------ Locale is : en_US_CA ------------ @@ -112,9 +115,10 @@ datetype = 2 ,timetype =2 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = 3 ,timetype =3 -Parsed text is : -1149060 -datetype = -1 ,timetype =-1 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' +datetype = -1 ,timetype =-1 +Error while parsing as: 'datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle. +The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.: U_BUFFER_OVERFLOW_ERROR' ------------ Input text is : 19691218 08:49 AM @@ -130,4 +134,4 @@ datetype = 3 ,timetype =3 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = -1 ,timetype =-1 -Parsed text is : -1149060 +Parsed text is : -1149060 \ No newline at end of file
http://cvs.php.net/viewvc.cgi/pecl/intl/dateformat/dateformat_format.c?r1=1.1.2.5&r2=1.1.2.6&diff_format=u Index: pecl/intl/dateformat/dateformat_format.c diff -u pecl/intl/dateformat/dateformat_format.c:1.1.2.5 pecl/intl/dateformat/dateformat_format.c:1.1.2.6 --- pecl/intl/dateformat/dateformat_format.c:1.1.2.5 Thu Mar 6 19:54:43 2008 +++ pecl/intl/dateformat/dateformat_format.c Fri Mar 21 23:59:28 2008 @@ -31,10 +31,10 @@ /* {{{ * Internal function which calls the udat_format */ -static void internal_format(DateFormatter_object *mfo, double timestamp , zval *return_value TSRMLS_DC){ +static void internal_format(DateFormatter_object *mfo, UDate timestamp , zval *return_value TSRMLS_DC){ UChar* formatted = NULL; - int resultlengthneeded =0 ; - + int32_t resultlengthneeded =0 ; + resultlengthneeded=udat_format( DATE_FORMAT_OBJECT(mfo), timestamp, NULL, resultlengthneeded, NULL, &INTL_DATA_ERROR_CODE(mfo)); if(INTL_DATA_ERROR_CODE(mfo)==U_BUFFER_OVERFLOW_ERROR) { @@ -89,7 +89,7 @@ UBool isInDST = FALSE; //Fetch values from the incoming array - year = internal_get_arr_ele( mfo , hash_arr , CALENDAR_YEAR TSRMLS_CC); + year = internal_get_arr_ele( mfo , hash_arr , CALENDAR_YEAR TSRMLS_CC) + 1900; //tm_year is years since 1900 month = internal_get_arr_ele( mfo , hash_arr , CALENDAR_MON TSRMLS_CC); hour = internal_get_arr_ele( mfo , hash_arr , CALENDAR_HOUR TSRMLS_CC); minute = internal_get_arr_ele( mfo , hash_arr , CALENDAR_MIN TSRMLS_CC); @@ -118,7 +118,8 @@ * Format the time value as a string. }}}*/ PHP_FUNCTION(datefmt_format) { - double timestamp =0; + UDate timestamp =0; + UDate p_timestamp =0; UCalendar* temp_cal ; HashTable* hash_arr = NULL; zval* zarg = NULL; @@ -140,10 +141,13 @@ switch(Z_TYPE_P(zarg) ){ case IS_LONG: - //Purposely fallthrough + p_timestamp = Z_LVAL_P(zarg) ; + timestamp = p_timestamp * 1000; + break; case IS_DOUBLE: //timestamp*1000 since ICU expects it in milliseconds - timestamp = (Z_LVAL_P(zarg) * 1000); + p_timestamp = Z_DVAL_P(zarg) ; + timestamp = p_timestamp * 1000; break; case IS_ARRAY: hash_arr = Z_ARRVAL_P(zarg); @@ -165,7 +169,7 @@ */ default: intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_format: takes either an array or a DateTime object or an integer TimeStamp value ", 0 TSRMLS_CC ); + "datefmt_format: takes either an array or an integer TimeStamp value ", 0 TSRMLS_CC ); RETURN_FALSE; } http://cvs.php.net/viewvc.cgi/pecl/intl/dateformat/dateformat_parse.c?r1=1.1.2.5&r2=1.1.2.6&diff_format=u Index: pecl/intl/dateformat/dateformat_parse.c diff -u pecl/intl/dateformat/dateformat_parse.c:1.1.2.5 pecl/intl/dateformat/dateformat_parse.c:1.1.2.6 --- pecl/intl/dateformat/dateformat_parse.c:1.1.2.5 Thu Mar 13 18:20:10 2008 +++ pecl/intl/dateformat/dateformat_parse.c Fri Mar 21 23:59:28 2008 @@ -39,8 +39,8 @@ * if set to 0 - no need to store any error encountered in the parameter parse_error */ static void internal_parse_to_timestamp(DateFormatter_object *mfo, char* text_to_parse , int text_len, int parse_pos , zval *return_value TSRMLS_DC){ - - int32_t timestamp =0; + long int result = 0; + UDate timestamp =0; UChar* text_utf16 = NULL; int32_t text_utf16_len = 0; @@ -48,23 +48,32 @@ intl_convert_utf8_to_utf16(&text_utf16 , &text_utf16_len , text_to_parse , text_len, &INTL_DATA_ERROR_CODE(mfo)); INTL_METHOD_CHECK_STATUS(mfo, "Error converting timezone to UTF-16" ); - timestamp = udat_parse( DATE_FORMAT_OBJECT(mfo), text_utf16 , text_utf16_len , &parse_pos , &INTL_DATA_ERROR_CODE(mfo)); if( text_utf16 ){ efree(text_utf16); } INTL_METHOD_CHECK_STATUS( mfo, "Date parsing failed" ); - + //Since return is in sec. - RETURN_LONG( timestamp / 1000 ); + result = (long int)( timestamp / 1000 ); + if( result != (timestamp/1000) ) { + intl_error_set( NULL, U_BUFFER_OVERFLOW_ERROR, + "datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle.\nThe valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.", 0 TSRMLS_CC ); + } + RETURN_LONG( result ); } /* }}} */ static void add_to_localtime_arr( DateFormatter_object *mfo, zval* return_value ,UCalendar parsed_calendar , int32_t calendar_field , char* key_name TSRMLS_DC){ int calendar_field_val = ucal_get( parsed_calendar , calendar_field , &INTL_DATA_ERROR_CODE(mfo)); INTL_METHOD_CHECK_STATUS( mfo, "Date parsing - localtime failed : could not get a field from calendar" ); - add_assoc_long( return_value, key_name , calendar_field_val ); + if( strcmp(key_name , CALENDAR_YEAR )==0 ){ + //since tm_year is years from 1900 + add_assoc_long( return_value, key_name ,( calendar_field_val-1900) ); + }else{ + add_assoc_long( return_value, key_name , calendar_field_val ); + } } /* {{{ @@ -97,7 +106,7 @@ add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_SECOND , CALENDAR_SEC TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_MINUTE , CALENDAR_MIN TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_HOUR_OF_DAY , CALENDAR_HOUR TSRMLS_CC); - add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_YEAR , CALENDAR_YEAR TSRMLS_CC); + add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_YEAR , CALENDAR_YEAR TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_MONTH , CALENDAR_MDAY TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_WEEK , CALENDAR_WDAY TSRMLS_CC); add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_YEAR , CALENDAR_YDAY TSRMLS_CC); http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_format.phpt?r1=1.1.2.5&r2=1.1.2.6&diff_format=u Index: pecl/intl/tests/dateformat_format.phpt diff -u pecl/intl/tests/dateformat_format.phpt:1.1.2.5 pecl/intl/tests/dateformat_format.phpt:1.1.2.6 --- pecl/intl/tests/dateformat_format.phpt:1.1.2.5 Thu Mar 13 18:20:10 2008 +++ pecl/intl/tests/dateformat_format.phpt Fri Mar 21 23:59:28 2008 @@ -33,6 +33,7 @@ 1200000, 2200000000, -2200000000, + 90099999, 3600, -3600 ); @@ -192,30 +193,45 @@ ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted timestamp is : Wednesday, December 31, 1969 4:00:00 PM PT +Formatted timestamp is : Sunday, September 18, 2039 4:06:40 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted timestamp is : December 31, 1969 4:00:00 PM PST +Formatted timestamp is : September 18, 2039 4:06:40 PM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted timestamp is : Dec 31, 1969 4:00:00 PM +Formatted timestamp is : Sep 18, 2039 4:06:40 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 -Formatted timestamp is : 12/31/69 4:00 PM +Formatted timestamp is : 9/18/39 4:06 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted timestamp is : 19691231 04:00 PM +Formatted timestamp is : 20390918 04:06 PM ------------ Input timestamp is : -2200000000 ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted timestamp is : Wednesday, December 31, 1969 4:00:00 PM PT +Formatted timestamp is : Saturday, April 14, 1900 5:53:20 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted timestamp is : December 31, 1969 4:00:00 PM PST +Formatted timestamp is : April 14, 1900 5:53:20 PM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted timestamp is : Dec 31, 1969 4:00:00 PM +Formatted timestamp is : Apr 14, 1900 5:53:20 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 -Formatted timestamp is : 12/31/69 4:00 PM +Formatted timestamp is : 4/14/00 5:53 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted timestamp is : 19691231 04:00 PM +Formatted timestamp is : 19000414 05:53 PM +------------ + +Input timestamp is : 90099999 +------------ + +DateFormatter locale= en_US ,datetype = 0 ,timetype =0 +Formatted timestamp is : Wednesday, November 8, 1972 11:46:39 AM PT +DateFormatter locale= en_US ,datetype = 1 ,timetype =1 +Formatted timestamp is : November 8, 1972 11:46:39 AM PST +DateFormatter locale= en_US ,datetype = 2 ,timetype =2 +Formatted timestamp is : Nov 8, 1972 11:46:39 AM +DateFormatter locale= en_US ,datetype = 3 ,timetype =3 +Formatted timestamp is : 11/8/72 11:46 AM +DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 +Formatted timestamp is : 19721108 11:46 AM ------------ Input timestamp is : 3600 @@ -252,57 +268,57 @@ ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted localtime_array is : Thursday, April 3, 0105 7:03:24 PM PT +Formatted localtime_array is : Sunday, April 3, 2005 7:03:24 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted localtime_array is : April 3, 0105 7:03:24 PM PDT +Formatted localtime_array is : April 3, 2005 7:03:24 PM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted localtime_array is : Apr 3, 0105 7:03:24 PM +Formatted localtime_array is : Apr 3, 2005 7:03:24 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 4/3/05 7:03 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted localtime_array is : 01050403 07:03 PM +Formatted localtime_array is : 20050403 07:03 PM ------------ Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '3' , tm_mday : '3' , tm_mon : '3' , tm_year : '205' , tm_wday : '0' , tm_yday : '92' , tm_isdst : '1' , ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted localtime_array is : Wednesday, April 3, 0205 3:03:24 AM PT +Formatted localtime_array is : Friday, April 3, 2105 3:03:24 AM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted localtime_array is : April 3, 0205 3:03:24 AM PDT +Formatted localtime_array is : April 3, 2105 3:03:24 AM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted localtime_array is : Apr 3, 0205 3:03:24 AM +Formatted localtime_array is : Apr 3, 2105 3:03:24 AM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 4/3/05 3:03 AM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted localtime_array is : 02050403 03:03 AM +Formatted localtime_array is : 21050403 03:03 AM ------------ Input localtime is : tm_sec : '0' , tm_min : '0' , tm_hour : '5' , tm_mday : '12' , tm_mon : '12' , tm_year : '205' , tm_wday : '0' , tm_yday : '92' , tm_isdst : '1' , ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted localtime_array is : Sunday, January 12, 0206 5:00:00 AM PT +Formatted localtime_array is : Tuesday, January 12, 2106 5:00:00 AM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted localtime_array is : January 12, 0206 5:00:00 AM PDT +Formatted localtime_array is : January 12, 2106 5:00:00 AM PST DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted localtime_array is : Jan 12, 0206 5:00:00 AM +Formatted localtime_array is : Jan 12, 2106 5:00:00 AM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 1/12/06 5:00 AM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted localtime_array is : 02060112 05:00 AM +Formatted localtime_array is : 21060112 05:00 AM ------------ Input localtime is : tm_sec : '0' , tm_min : '0' , tm_hour : '21' , tm_mday : '12' , tm_mon : '12' , tm_year : '205' , tm_wday : '0' , tm_yday : '92' , tm_isdst : '1' , ------------ DateFormatter locale= en_US ,datetype = 0 ,timetype =0 -Formatted localtime_array is : Sunday, January 12, 0206 9:00:00 PM PT +Formatted localtime_array is : Tuesday, January 12, 2106 9:00:00 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 -Formatted localtime_array is : January 12, 0206 9:00:00 PM PDT +Formatted localtime_array is : January 12, 2106 9:00:00 PM PST DateFormatter locale= en_US ,datetype = 2 ,timetype =2 -Formatted localtime_array is : Jan 12, 0206 9:00:00 PM +Formatted localtime_array is : Jan 12, 2106 9:00:00 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 1/12/06 9:00 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 -Formatted localtime_array is : 02060112 09:00 PM \ No newline at end of file +Formatted localtime_array is : 21060112 09:00 PM http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_localtime.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: pecl/intl/tests/dateformat_localtime.phpt diff -u pecl/intl/tests/dateformat_localtime.phpt:1.1.2.3 pecl/intl/tests/dateformat_localtime.phpt:1.1.2.4 --- pecl/intl/tests/dateformat_localtime.phpt:1.1.2.3 Thu Mar 13 18:20:10 2008 +++ pecl/intl/tests/dateformat_localtime.phpt Fri Mar 21 23:59:28 2008 @@ -105,7 +105,7 @@ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM ------------ DateFormatter : DateType::FULL, TimeType::FULL -tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '1969' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , +tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '69' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , ------------------------------- Input text is : Thursday, December 18, 1969 8:49:59 PM PST @@ -119,7 +119,7 @@ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM ------------ DateFormatter : DateType::FULL, TimeType::FULL -tm_sec : '59' , tm_min : '49' , tm_hour : '20' , tm_year : '1969' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , +tm_sec : '59' , tm_min : '49' , tm_hour : '20' , tm_year : '69' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , ------------------------------- Input text is : June 18, 1969 8:49:59 AM PST @@ -129,10 +129,10 @@ DateFormatter : DateType::NONE, TimeType::NONE ------------ DateFormatter : DateType::LONG, TimeType::LONG -tm_sec : '59' , tm_min : '49' , tm_hour : '9' , tm_year : '1969' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , +tm_sec : '59' , tm_min : '49' , tm_hour : '9' , tm_year : '69' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , ------------ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM -tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '1969' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , +tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '69' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , ------------ DateFormatter : DateType::FULL, TimeType::FULL ------------------------------- http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_parse.phpt?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: pecl/intl/tests/dateformat_parse.phpt diff -u pecl/intl/tests/dateformat_parse.phpt:1.1.2.4 pecl/intl/tests/dateformat_parse.phpt:1.1.2.5 --- pecl/intl/tests/dateformat_parse.phpt:1.1.2.4 Thu Mar 13 18:20:10 2008 +++ pecl/intl/tests/dateformat_parse.phpt Fri Mar 21 23:59:28 2008 @@ -28,6 +28,7 @@ $text_arr = array ( + "Sunday, September 18, 2039 4:06:40 PM PT", "Thursday, December 18, 1969 8:49:59 AM PST", "Thursday, December 18, 1969 8:49:59 PM PST", "December 18, 1969 8:49:59 AM PST", @@ -63,6 +64,8 @@ ut_run(); ?> --EXPECT-- +Input text :Sunday, September 18, 2039 4:06:40 PM PT ; Parsed text : 96000 ; parse_pos : 29 +Input text :Sunday, September 18, 2039 4:06:40 PM PT ; Parsed text : 96000 ; parse_pos : 30 Input text :Thursday, December 18, 1969 8:49:59 AM PST ; Parsed text : 208740 ; parse_pos : 30 Input text :Thursday, December 18, 1969 8:49:59 AM PST ; Parsed text : 64740 ; parse_pos : 31 Input text :Thursday, December 18, 1969 8:49:59 PM PST ; Parsed text : 251940 ; parse_pos : 30 @@ -73,4 +76,4 @@ Input text :12/18/69 8:49 AM ; Parsed text : 60540 ; parse_pos : 9 Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 8 Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 9 -Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 10 +Input text :19691218 08:49 AM ; Parsed text : 60540 ; parse_pos : 10 \ No newline at end of file http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt diff -u pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt:1.1.2.1 pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt:1.1.2.2 --- pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt:1.1.2.1 Thu Mar 6 20:04:30 2008 +++ pecl/intl/tests/dateformat_parse_localtime_parsepos.phpt Fri Mar 21 23:59:28 2008 @@ -98,7 +98,7 @@ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM Error : 'Date parsing failed: U_PARSE_ERROR' ------------ DateFormatter : DateType::FULL, TimeType::FULL -tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '1969' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , +tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '69' , tm_mday : '18' , tm_wday : '5' , tm_yday : '352' , tm_mon : '11' , tm_isdst : '0' , ------------------------------- Input text is : June 18, 1969 8:49:59 AM PST @@ -108,10 +108,10 @@ DateFormatter : DateType::NONE, TimeType::NONE Error : 'Date parsing failed: U_PARSE_ERROR' ------------ DateFormatter : DateType::LONG, TimeType::LONG -tm_sec : '59' , tm_min : '49' , tm_hour : '9' , tm_year : '1969' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , +tm_sec : '59' , tm_min : '49' , tm_hour : '9' , tm_year : '69' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , ------------ DateFormatter : DateType::MEDIUM, TimeType::MEDIUM -tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '1969' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , +tm_sec : '59' , tm_min : '49' , tm_hour : '8' , tm_year : '69' , tm_mday : '18' , tm_wday : '4' , tm_yday : '169' , tm_mon : '5' , tm_isdst : '1' , ------------ DateFormatter : DateType::FULL, TimeType::FULL Error : 'Date parsing failed: U_PARSE_ERROR' ------------------------------- http://cvs.php.net/viewvc.cgi/pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt diff -u pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt:1.1.2.1 pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt:1.1.2.2 --- pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt:1.1.2.1 Thu Mar 6 20:04:30 2008 +++ pecl/intl/tests/dateformat_parse_timestamp_parsepos.phpt Fri Mar 21 23:59:28 2008 @@ -28,9 +28,11 @@ $text_arr = array ( + "Sunday, September 18, 3039 4:06:40 PM PT", "Thursday, December 18, 1969 8:49:59 AM PST", - "December 18, 1969 8:49:59 AM PST", - "12/18/69 8:49 AM", + //"December 18, 1969 8:49:59 AM PST", + //"12/18/69 8:49 AM", + "19001218 08:49 AM", "19691218 08:49 AM" ); @@ -69,12 +71,13 @@ --EXPECT-- ------------ -Input text is : Thursday, December 18, 1969 8:49:59 AM PST +Input text is : Sunday, September 18, 3039 4:06:40 PM PT ------------ Locale is : en_US_CA ------------ datetype = 0 ,timetype =0 -Parsed text is : -1149001 +Error while parsing as: 'datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle. +The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.: U_BUFFER_OVERFLOW_ERROR' datetype = 1 ,timetype =1 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = 2 ,timetype =2 @@ -85,23 +88,23 @@ Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' ------------ -Input text is : December 18, 1969 8:49:59 AM PST +Input text is : Thursday, December 18, 1969 8:49:59 AM PST ------------ Locale is : en_US_CA ------------ datetype = 0 ,timetype =0 -Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' -datetype = 1 ,timetype =1 Parsed text is : -1149001 +datetype = 1 ,timetype =1 +Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = 2 ,timetype =2 -Parsed text is : -1149001 +Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = 3 ,timetype =3 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = -1 ,timetype =-1 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' ------------ -Input text is : 12/18/69 8:49 AM +Input text is : 19001218 08:49 AM ------------ Locale is : en_US_CA ------------ @@ -112,9 +115,10 @@ datetype = 2 ,timetype =2 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = 3 ,timetype =3 -Parsed text is : -1149060 -datetype = -1 ,timetype =-1 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' +datetype = -1 ,timetype =-1 +Error while parsing as: 'datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle. +The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.: U_BUFFER_OVERFLOW_ERROR' ------------ Input text is : 19691218 08:49 AM @@ -130,4 +134,4 @@ datetype = 3 ,timetype =3 Error while parsing as: 'Date parsing failed: U_PARSE_ERROR' datetype = -1 ,timetype =-1 -Parsed text is : -1149060 +Parsed text is : -1149060 \ No newline at end of file