diff options
-rw-r--r-- | ext/date/php_date.c | 4 | ||||
-rw-r--r-- | ext/date/tests/bug67118.phpt | 3 | ||||
-rw-r--r-- | ext/date/tests/bug67118_2.phpt | 13 |
3 files changed, 7 insertions, 13 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index f9dd31a069..a78f766d1a 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2718,7 +2718,9 @@ PHP_METHOD(DateTime, __construct) zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { - php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); + if (!php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC)) { + ZVAL_NULL(getThis()); + } } zend_restore_error_handling(&error_handling TSRMLS_CC); } diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt index 973b4eb8d5..2aa8c1d828 100644 --- a/ext/date/tests/bug67118.phpt +++ b/ext/date/tests/bug67118.phpt @@ -23,5 +23,4 @@ class mydt extends datetime new mydt("Funktionsansvarig rÄdgivning och juridik", "UTC"); ?> --EXPECTF-- -Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug67118.php on line %d -Bad date +Fatal error: Call to a member function format() on a non-object in %sbug67118.php on line %d diff --git a/ext/date/tests/bug67118_2.phpt b/ext/date/tests/bug67118_2.phpt index b4904a1583..368d4d9401 100644 --- a/ext/date/tests/bug67118_2.phpt +++ b/ext/date/tests/bug67118_2.phpt @@ -1,5 +1,5 @@ --TEST-- -Regression introduce in fix for Bug #67118 +Regression introduce in fix for Bug #67118 - Invalid code --INI-- date.timezone=Europe/Paris --FILE-- @@ -24,12 +24,5 @@ Done --EXPECTF-- First try Second try -object(Foo)#1 (3) { - ["date"]=> - string(%d) "2007-09-12 15:49:%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(3) "UTC" -} -Done +NULL +Done
\ No newline at end of file |