Edit report at https://bugs.php.net/bug.php?id=60302&edit=1

 ID:                 60302
 Updated by:         der...@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

Reply via email to