hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

Zend Incompatability: DateTime comparison

Open crgwbr opened this issue 13 years ago • 4 comments

Comparison operators with DateTime object don't seem to work the same as they do in Zend.

Test Case:

<?php
$d1 = new DateTime('Tue, 13 Aug 2013 13:24:00 +0000');
$d2 = new DateTime('Wed, 14 Aug 2013 13:24:00 +0000');
var_dump($d2 > $d1);
var_dump($d2 < $d1);

ZendPHP output:

$ php test.php
bool(true)
bool(false)

HHVM Output:

$ hhvm test.php
bool(false)
bool(false)

crgwbr avatar Nov 18 '13 20:11 crgwbr

Thanks for reporting this. Feel free to submit a PR if you (or anyone else) get to this before we do.

scannell avatar Nov 18 '13 20:11 scannell

For anyone else affected: $date->getTimestamp() is an easy way to work around this.

crgwbr avatar Nov 18 '13 20:11 crgwbr

I think @ptarjan already has a fix for this one?

jdelong avatar Nov 18 '13 20:11 jdelong

Yup, fixed by https://github.com/facebook/hhvm/commit/525d97518e1e0ef90c9e896eb0a280a50cb801b8

ptarjan avatar Nov 19 '13 04:11 ptarjan