Table of Contents

PHP RFC: DateTimeInterface removal

The \DateTimeInterface is an implementation detail of ext/date that should not have been exposed to userland code. The reason for it to be an internal detail is that ext/date does NOT rely on the interface itself, but on internal state of the \DateTime and \DateTimeImmutable implementations, as explained in Pull request #512 and Bug #65768.

Because of the internal ext/date interactions, PHP 5.5.8 introduced a major BC break by making it impossible to implement \DateTimeInterface in userland.

This sort of behavior is what may become yet another of those quirks in the language that depreciate PHP.

Proposal

This RFC proposes its removal from PHP 7.0.0 even though it represents a BC break.

Alternatives

An alternative solution to the currently standing issue is to make ext/date rely on the interface internally, and therefore actually fix Bug #65768. There may not be enough time to do that, though, which is why this proposal is being advanced, rather than a more “elaborate” fix.

Backward Incompatible Changes

Applications relying on \DateTimeInterface would need to explicitly switch back to checking against \DateTime and \DateTimeImmutable.

Software compatible with PHP 5.5.0~5.5.7 and implementing \DateTimeInterface would break anyway. Software checking against \DateTimeInterface via instanceof.

Proposed PHP Version(s)

PHP 7.0.0 List the proposed PHP versions that the feature will be included in. Use relative versions such as “next PHP 5.x” or “next PHP 5.x.y”.

RFC Impact

To Existing Extensions

ext/session

Proposed Voting Choices

2/3 majority due to major BC break involvement.

Patches and Tests

Links to any external patches and tests go here.

If there is no patch, make it clear who will create a patch, or whether a volunteer to help with implementation is needed.

Make it clear if the patch is intended to be the final patch, or is just a prototype.

Implementation

None, so far. Joe Watkins told me that he has a patch for it.