php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78000 Missing description of reltext's different behaviors (static & method on object)
Submitted: 2019-05-10 14:22 UTC Modified: 2019-05-10 16:49 UTC
From: ssimo3 at lsuhsc dot edu Assigned:
Status: Closed Package: Date/time related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ssimo3 at lsuhsc dot edu
New email:
PHP Version: OS:

 

 [2019-05-10 14:22 UTC] ssimo3 at lsuhsc dot edu
Description:
------------
---
From manual page: https://php.net/datetime.formats.relative
---

What is missing is the following paragraph:

"The referent of the reltext keywords depend on the context in which the relative format string is used. If used with a static method or function, the referent is the current system timestamp. However, if used in DateTime::modify() or DateTimeImmutable::modify(), the referent is the object on which the modify() method is called."

Thank you! 

Test script:
---------------
<?php
header("Content-Type: text/plain");
$thisMonthDateTime = date_create("first day of this month");
echo $thisMonthDateTime->format("Y-m-d") . "\r\n";
$januaryDateTime = DateTime::createFromFormat("Y-m-d", "2019-01-15");
$januaryDateTime->modify("first day of this month");
echo $januaryDateTime->format("Y-m-d");

Actual result:
--------------
The two displayed dates are different, AS THEY SHOULD BE. What is missing is DOCUMENTATION of the behavior.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-10 16:49 UTC] girgias@php.net
-Summary: Description of reltext behavior +Summary: Missing description of reltext's different behaviors (static & method on object) -Status: Open +Status: Verified -Operating System: Windows 10 x64 +Operating System: -PHP Version: 7.3.5 +PHP Version: Irrelevant
 [2022-06-02 16:03 UTC] git@php.net
Automatic comment on behalf of derickr
Revision: https://github.com/php/doc-en/commit/26e0c6ef75d4a9a218462a5153c604e37b59f3c7
Log: Fixed bug #78000: Missing description of reltext's different behaviors (static &amp; method on object)
 [2022-06-02 16:03 UTC] git@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 12:01:29 2024 UTC