com php-src: restore correct behavior of DateTime: ext/date/php _date.c ext/date/tests/bug67118.phpt
| From: | Remi Collet | Date: | Thu, 05 Jun 2014 12:04:44 +0000 |
| Subject: | com php-src: restore correct behavior of DateTime: ext/date/php _date.c ext/date/tests/bug67118.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78699@lists.php.net to get a copy of this message | ||
Commit: f11f7f56013c5ee4e6009997602e9b5a64064909
Author: Remi Collet <remi@php.net> Thu, 5 Jun 2014 14:04:44 +0200
Parents: f1ef7018f036de3b0d149ea0bc4575767b9bb413
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f11f7f56013c5ee4e6009997602e9b5a64064909
Log:
restore correct behavior of DateTime
Changed paths:
M ext/date/php_date.c
M ext/date/tests/bug67118.phpt
Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 1809d66..7009291 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -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);
}
diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt
index 973b4eb..2aa8c1d 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