Skip to content

[PHP82] DateTime modify does not work with addition of minus values #9950

@shyim

Description

@shyim

Description

The following code:

<?php
$a = (new \DateTimeImmutable('2022-05-01 22:00:00'))->modify('+-30 seconds');

var_dump($a);

Resulted in this output:

Adds 30 seconds

But I expected this output instead:

Should substract 30 seconds like before

https://3v4l.org/6eMQj

It did work before RC3. I am not sure if this is intended or not 😅

PHP Version

PHP 8.2.0 RC6

Operating System

macOs Ventura 13.1 Beta 2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions