#45696 [NEW]: Allow method-chaining for misc. DateTime methods
| From: | mathieuk at gmail dot com | Date: | Sun, 03 Aug 2008 08:25:15 +0000 |
| Subject: | #45696 [NEW]: Allow method-chaining for misc. DateTime methods | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-127535@lists.php.net to get a copy of this message | ||
From: mathieuk at gmail dot com
Operating system: Mac OSX 10.5.3
PHP version: 5.3CVS-2008-08-03 (CVS)
PHP Bug Type: Feature/Change Request
Bug description: Allow method-chaining for misc. DateTime methods
Description:
------------
Feature request.
Might be nice if the new DateTime::add(), DateTime::sub() and already
existing DateTime::modify() methods would allow method chaining.
Reproduce code:
---------------
$datetime = new DateTime();
$interval = DateInterval::createFromDateString('2 weeks');
echo $datetime->add($interval)->format('d-m-Y H:i');
Expected result:
----------------
An echo'ed string showing the date of 2 weeks from 'now'.
Actual result:
--------------
Fatal error: Call to a member function format() on a non-object in
/Users/mathieu/Source/tests/datetime/Modify.php on line 4
--
Edit bug report at http://bugs.php.net/?id=45696&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45696&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45696&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45696&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45696&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45696&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45696&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45696&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45696&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45696&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45696&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45696&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45696&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45696&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45696&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45696&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45696&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45696&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45696&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45696&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45696&r=mysqlcfg