php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78540 DateInterval documentation has not been updated
Submitted: 2019-09-15 00:24 UTC Modified: -
From: danielklein at airpost dot net Assigned:
Status: Open Package: Documentation problem
PHP Version: 7.3.9 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
14 + 16 = ?
Subscribe to this entry?

 
 [2019-09-15 00:24 UTC] danielklein at airpost dot net
Description:
------------
---
From manual page: https://php.net/dateinterval.construct
---
The "Example #1 DateInterval example" code now produces different output to that shown, since new properties have been added to the class. It doesn't state how to set any of these new properties with the constructor, in particular the microseconds property.

Test script:
---------------
<?php

$interval = new DateInterval('P2Y4DT6H8M');
var_dump($interval);

?>

Actual result:
--------------
class DateInterval#1 (16) {
  public $y =>
  int(2)
  public $m =>
  int(0)
  public $d =>
  int(4)
  public $h =>
  int(6)
  public $i =>
  int(8)
  public $s =>
  int(0)
  public $f =>
  double(0)
  public $weekday =>
  int(0)
  public $weekday_behavior =>
  int(0)
  public $first_last_day_of =>
  int(0)
  public $invert =>
  int(0)
  public $days =>
  bool(false)
  public $special_type =>
  int(0)
  public $special_amount =>
  int(0)
  public $have_weekday_relative =>
  int(0)
  public $have_special_relative =>
  int(0)
}

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-02-16 17:06 UTC] carusogabriel@php.net
The following pull request has been associated:

Patch Name: Fix #78540: Add missing DateInterval properties
On GitHub:  https://github.com/php/doc-en/pull/44
Patch:      https://github.com/php/doc-en/pull/44.patch
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 01:01:28 2024 UTC