]> granicus.if.org Git - php/commitdiff
restore correct behavior of DateTime
authorRemi Collet <remi@php.net>
Thu, 5 Jun 2014 12:04:44 +0000 (14:04 +0200)
committerRemi Collet <remi@php.net>
Thu, 5 Jun 2014 12:04:44 +0000 (14:04 +0200)
ext/date/php_date.c
ext/date/tests/bug67118.phpt

index 1809d6653b57d2e8ebc59fd09a3f9a3001f1caca..700929154cc7764f6932d2848345b0f0351a30ed 100644 (file)
@@ -2731,7 +2731,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);
 }
index 973b4eb8d52e6e8d8ded0af70d1a5a6212d6a7ea..2aa8c1d8285451a3b85faf5523f6ea7d6913ddb2 100644 (file)
@@ -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