# DateTime->modify('tomorrow') Bug in PHP 5.3 on Linux

- Thread: https://externals.io/message/66592
- Original archive: https://news-web.php.net/php.internals/66592
- Started by Christian Stoller on 2013-03-12T15:59:01+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #66592 — Christian Stoller — 2013-03-12T15:59:01+00:00

URL: https://externals.io/message/66592#66592

Dear internals,

I have a strange bug with DateTime->modify('tomorrow') in PHP 5.3 on Linux.
Code to reproduce:

<?php
$d = new DateTime('2013-02-05 06:33:33');
echo $d->format('Y-m-d H:i:s')."\n";

$d->modify('tomorrow');
echo $d->format('Y-m-d H:i:s')."\n";
?>

Current output on Windows with PHP 5.3.14:
2013-02-05 06:33:33
2013-02-06 00:00:00

Current output on Linux (Debian) with PHP 5.3.3-7+squeeze15:
2013-02-05 06:33:33
2013-02-06 06:33:33

Can somebody verify this behavior? Are there any information about that or is there already something in the bugtracker? I have googled but couldn't find anything about that.


Best regards
Christian Stoller

---

## #66593 — Derick Rethans — 2013-03-12T16:04:51+00:00

URL: https://externals.io/message/66592#66593 · In reply to: #66592

> I have a strange bug with DateTime->modify('tomorrow') in PHP 5.3 on Linux.
> Code to reproduce:
> 
> <?php
> $d = new DateTime('2013-02-05 06:33:33');
> echo $d->format('Y-m-d H:i:s')."\n";
> 
> $d->modify('tomorrow');
> echo $d->format('Y-m-d H:i:s')."\n";
> ?>
> 
> Current output on Windows with PHP 5.3.14:
> 2013-02-05 06:33:33
> 2013-02-06 00:00:00
> 
> Current output on Linux (Debian) with PHP 5.3.3-7+squeeze15:
> 2013-02-05 06:33:33
> 2013-02-06 06:33:33
> 
> Can somebody verify this behavior? Are there any information about 
> that or is there already something in the bugtracker? I have googled 
> but couldn't find anything about that.

The 5.3.14 result is correct. It was apparently a bug in earlier 5.3 
versions.

cheers,
Derick

---

## #66594 — Jonathan Sundquist — 2013-03-12T16:07:14+00:00

URL: https://externals.io/message/66592#66594 · In reply to: #66593

Why would the result not preserve the time?




> 
>
> > […]
> Linux.
> > […]
>
> The 5.3.14 result is correct. It was apparently a bug in earlier 5.3
> versions.
>
> cheers,
> Derick

---

## #66595 — Derick Rethans — 2013-03-12T16:30:27+00:00

URL: https://externals.io/message/66592#66595 · In reply to: #66594

No top posting please!


> 
> 
> 
> > […]
>
> Why would the result not preserve the time?

Because "tomorrow" starts at midnight. You want "+1 day".

cheers,
Derick

---

## #66598 — keisial@gmail.com — 2013-03-12T18:08:57+00:00

URL: https://externals.io/message/66592#66598 · In reply to: #66595

> 
> > […]
> Because "tomorrow" starts at midnight. You want "+1 day".
>
> cheers,
> Derick
Alternatively, $d->add(new DateInterval('P1D'));

---

## #66600 — Christian Stoller — 2013-03-13T09:34:38+00:00

URL: https://externals.io/message/66592#66600 · In reply to: #66593

Hi Derick.

> The 5.3.14 result is correct. It was apparently a bug in earlier 5.3 
> versions.
>
> cheers,
> Derick

Thanks for this hint. So I guess that Debian has not ported the bugfix. Do you know the Git Revision of the patch? I would like to inform the PHP maintainers of Debian so that they can easily integrate the fix.

Thanks for help!
