Skip to content

Signed integer overflow at ext/date/lib/interval.c:131 #16775

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
define("MAX_64Bit", 9223372036854775807);
define("MIN_64Bit", -9223372036854775807 - 1);
$longVals = array(
MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
);
foreach ($longVals as $longVal) {
}
$fusion = $longVal;
$d1 = new DateTime('now',new DateTimeZone('Europe/Paris'));
$d2 = new DateTime('now',new DateTimeZone('Europe/Paris'));
$d1->setTimestamp($fusion);
$diff = $d1->diff($d2);

Resulted in this output:

runtime error: signed integer overflow: 1731482775 - -9223372036854775808 cannot be represented in type 'long long'

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