Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime->diff having issues with leap days #8142

Open
simonwelsh opened this issue Mar 1, 2018 · 0 comments
Open

DateTime->diff having issues with leap days #8142

simonwelsh opened this issue Mar 1, 2018 · 0 comments

Comments

@simonwelsh
Copy link
Contributor

HHVM Version

3.24.2

Standalone code, or other way to reproduce the problem

<?php

date_default_timezone_set('UTC');

$d = new DateTime('2008-03-01');
$a = new DateTime('2018-03-01');

var_dump($d->diff($a)->y);

date_default_timezone_set('Europe/Amsterdam');

$d = new DateTime('2008-03-01');
$a = new DateTime('2018-03-01');

var_dump($d->diff($a)->y);

Expected result

int(10)
int(10)

Actual result

int(10)
int(9)

PHP bug report: https://bugs.php.net/bug.php?id=76032

facebook-github-bot pushed a commit that referenced this issue Oct 19, 2019
Summary:
Pull Request resolved: facebook/flow#8142

previously, `File_url.parse "file:///c%3A/foo/bar"` returned `"c:/foo/bar"` instead of `"c:\foo\bar"`, because `/` and `\` are (generally) interchangeable on Windows.

however, `Sys_utils.realpath` does convert them to `\` (only if the file exists, otherwise it leaves it alone!), which makes it more difficult to compare two paths.

so, we now match `realpath`'s behavior, converting `/` to `\` on Windows.

also, `File_url.create "c:\foo\bar"` returns `"file:///c%3A/foo/bar"` on Windows, but on Linux, `\` is a valid path character and should be escaped, like `"file:///c%3A%5Cfoo%5Cbar"`.

Reviewed By: gabelevi, samwgoldman

Differential Revision: D18024985

fbshipit-source-id: 7fcd0e5c03b30045357f14b133fc94907b231163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant