Commit: 887744f6b40946ad14b9c5f3f1b6b191a84dad6a Author: Gustavo André dos Santos Lopes <cataphr...@php.net> Thu, 17 May 2012 18:16:54 +0200 Parents: ec23c3e5401f2bf4b752e8ae64383932135eef10 Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=887744f6b40946ad14b9c5f3f1b6b191a84dad6a Log: Fixed bad DateTime construction state check Changed paths: M ext/intl/calendar/calendar_methods.cpp M ext/intl/tests/calendar_fromDateTime_error.phpt Diff: diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index e9565fc..82ccd80 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -1142,7 +1142,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) } datetime = (php_date_obj*)zend_object_store_get_object(zv_datetime TSRMLS_CC); - if (!datetime) { + if (!datetime->time) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_from_date_time: DateTime object is unconstructed", 0 TSRMLS_CC); @@ -1182,6 +1182,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) } cal->setTime(((UDate)Z_LVAL_P(zv_timestamp)) * 1000., status); if (U_FAILURE(status)) { + /* time zone was adopted by cal; should not be deleted here */ delete cal; intl_error_set(NULL, status, "intlcal_from_date_time: " "error creating ICU Calendar::setTime()", 0 TSRMLS_CC); diff --git a/ext/intl/tests/calendar_fromDateTime_error.phpt b/ext/intl/tests/calendar_fromDateTime_error.phpt index b3cb22a..2fbf719 100644 --- a/ext/intl/tests/calendar_fromDateTime_error.phpt +++ b/ext/intl/tests/calendar_fromDateTime_error.phpt @@ -44,9 +44,7 @@ Warning: IntlCalendar::fromDateTime() expects at most 2 parameters, 3 given in % Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d NULL threw exception, OK -Warning: DateTime::getTimestamp(): The DateTime object has not been correctly initialized by its constructor in %s on line %d - -Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad DateTime; call to DateTime::getTimestamp() failed in %s on line %d +Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: DateTime object is unconstructed in %s on line %d NULL Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: object has an time zone offset that's too large in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php