php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73301 DateTime::setTime breaks backwards compatibility
Submitted: 2016-10-12 11:53 UTC Modified: 2016-10-12 13:25 UTC
From: sjon at hortensius dot net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 7.1Git-2016-10-12 (Git) 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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sjon at hortensius dot net
New email:
PHP Version: OS:

 

 [2016-10-12 11:53 UTC] sjon at hortensius dot net
Description:
------------
DateTime::setTime was changed between RC3 and RC4 in a backward breaking way which seems highly unwanted.

Warning: Declaration of Custom_DateTime::setTime($hour, $minute, $second = 0) should be compatible with DateTime::setTime($hour, $minute, $second = NULL, $microseconds = NULL)

This causes applications to break; why was $second=0 not kept as a default?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-12 12:22 UTC] nikic@php.net
This is not related to the default value (which has not changed). We generally do not allow removing parameters, even optional ones, from method signatures: https://3v4l.org/i1Btt
 [2016-10-12 12:37 UTC] sjon at hortensius dot net
Ah, right; I was thrown off by the Exception message. It's nice functionality; and I'm not saying DateTime::setMicroTime would be better; but I'm also not sure about the timing of this feature.

Apparently quite a few issues were fixed by introducing this @ https://github.com/php/php-src/commit/55626549d81d0feadb1d160be78fcf2b898a48cc#diff-7b738accc3d60f74c259da18588ddc5d
 [2016-10-12 13:25 UTC] derick@php.net
-Status: Open +Status: Not a bug
 [2016-10-12 13:25 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This works as it supposed to be. There were no changes to the original defaults.
This addition was part of supporting, and fixing, microtime support across the board.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 10:01:32 2024 UTC