com php-src: Fix bug #65502: DateTimeImmutable::createFromFormat returns DateTime: NEWS ext/date/php_date.c ext/date/tests/bug6 5502.phpt
| From: | Nikita Popov | Date: | Thu, 12 Sep 2013 13:21:45 +0000 |
| Subject: | com php-src: Fix bug #65502: DateTimeImmutable::createFromFormat returns DateTime: NEWS ext/date/php_date.c ext/date/tests/bug6 5502.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73176@lists.php.net to get a copy of this message | ||
Commit: 165f544ae9a3ac674a533a45ad8a8d5dccfa2536
Author: Boro Sitnikovski <bsitnikovski@sugarcrm.com> Thu, 12 Sep 2013 01:50:52
+0200
Committer: Nikita Popov <nikic@php.net> Thu, 12 Sep 2013 15:21:45 +0200
Parents: d7f5f1ef35c32d6943cd76a3c51752e8d64c5e5e
Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=165f544ae9a3ac674a533a45ad8a8d5dccfa2536
Log:
Fix bug #65502: DateTimeImmutable::createFromFormat returns DateTime
DateTimeImmutable::createFromFormat should call
date_create_immutable_from_format instead of date_create_from_format
Bugs:
https://bugs.php.net/65502
Changed paths:
M NEWS
M ext/date/php_date.c
A ext/date/tests/bug65502.phpt
Diff:
diff --git a/NEWS b/NEWS
index 6575bd9..22cd012 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,8 @@ PHP NEWS
. Fixed bug #65458 (curl memory leak). (Adam)
- Datetime:
+ . Fixed bug #65502 (DateTimeImmutable::createFromFormat returns DateTime).
+ (Boro Sitnikovski)
. Fixed bug #65548 (Comparison for DateTimeImmutable doesn't work).
(Boro Sitnikovski)
. Fixed bug #65554 (createFromFormat broken when weekday name is followed
diff --git a/ext/date/php_date..c b/ext/date/php_date.c
index bb96227..7d3d1d7 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -480,7 +480,7 @@ const zend_function_entry date_funcs_immutable[] = {
PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format,
ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format,
arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors,
ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
diff --git a/ext/date/tests/bug65502.phpt b/ext/date/tests/bug65502.phpt
new file mode 100644
index 0000000..8819c1f
--- /dev/null
+++ b/ext/date/tests/bug65502.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test for bug #65502: DateTimeImmutable::createFromFormat returns DateTime
+--CREDITS--
+Boro Sitnikovski <buritomath@yahoo.com>
+--INI--
+date.timezone = UTC
+--FILE--
+<?php
+echo get_class(DateTimeImmutable::createFromFormat('j-M-Y', '12-Sep-2013'));
+?>
+--EXPECT--
+DateTimeImmutable