Req #60302 [Opn->Asn]: DateTime::createFromFormat should new static(), not new self()
| From: | derick@php.net | Date: | Mon, 14 Nov 2011 21:51:54 +0000 |
| Subject: | Req #60302 [Opn->Asn]: DateTime::createFromFormat should new static(), not new self() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165135@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60302&edit=1
ID: 60302
Updated by: derick@php.net
Reported by: kontakt at beberlei dot de
Summary: DateTime::createFromFormat should new static(), not
new self()
-Status: Open
+Status: Assigned
Type: Feature/Change Request
Package: Date/time related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Had a quick look at this, but it wasn't as simple as I thought. Needs some more investigation.
Previous Comments:
------------------------------------------------------------------------
[2011-11-14 20:00:54] kontakt at beberlei dot de
Description:
------------
I want to extend DateTime, but without DateTime::createFromFormat, actually creating instances from
my class, i.e. "MyDateTime::createFromFormat" this is rather problematic.
Test script:
---------------
<?php
class MyDateTime extends DateTime { }
$d = MyDateTime::createFromFormat('Y-m-d', '2011-01-01');
echo get_class($d);
Expected result:
----------------
MyDateTime
Actual result:
--------------
DateTime
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60302&edit=1