Skip to content

int overflow in Date extension #18422

Open
@chongwick

Description

@chongwick

Description

The following code:

<?php
date_default_timezone_set('UTC');

$dto = date_create("2006-12-12");

if ($dto instanceof DateTime) {
    var_dump(date_isodate_set($dto, PHP_INT_MAX, 100, 15));
    var_dump($dto->format("Y/m/d H:i:s"));
} else {
    echo "Failed to create DateTime object.\n";
}

Resulted in this output:

/nightly_php/php-src/ext/date/php_date.c:39:75: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself

But I expected this output instead:

PHP Version

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions