{"action":"created","issue":{"url":"https://api.github.com/repos/briannesbitt/Carbon/issues/1544","repository_url":"https://api.github.com/repos/briannesbitt/Carbon","labels_url":"https://api.github.com/repos/briannesbitt/Carbon/issues/1544/labels{/name}","comments_url":"https://api.github.com/repos/briannesbitt/Carbon/issues/1544/comments","events_url":"https://api.github.com/repos/briannesbitt/Carbon/issues/1544/events","html_url":"https://github.com/briannesbitt/Carbon/issues/1544","id":389261037,"node_id":"MDU6SXNzdWUzODkyNjEwMzc=","number":1544,"title":"diffForHumans() incompatible between PHP 7.1 and 7.2 ","user":{"login":"mheki","id":2435655,"node_id":"MDQ6VXNlcjI0MzU2NTU=","avatar_url":"https://avatars0.githubusercontent.com/u/2435655?v=4","gravatar_id":"","url":"https://api.github.com/users/mheki","html_url":"https://github.com/mheki","followers_url":"https://api.github.com/users/mheki/followers","following_url":"https://api.github.com/users/mheki/following{/other_user}","gists_url":"https://api.github.com/users/mheki/gists{/gist_id}","starred_url":"https://api.github.com/users/mheki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mheki/subscriptions","organizations_url":"https://api.github.com/users/mheki/orgs","repos_url":"https://api.github.com/users/mheki/repos","events_url":"https://api.github.com/users/mheki/events{/privacy}","received_events_url":"https://api.github.com/users/mheki/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-12-10T11:36:12Z","updated_at":"2018-12-10T13:11:27Z","closed_at":"2018-12-10T13:04:14Z","author_association":"NONE","body":"Hello,\r\n\r\nI encountered an issue with the following code:\r\n```php\r\n$deadline = Carbon::instance(new DateTime('+2 days'));\r\necho (new Carbon())->diffForHumans($deadline, true);\r\n```\r\nCarbon version: **1.36.1**\r\nPHP version: **PHP7.2**\r\n<!--\r\nRun the command `composer show nesbot/carbon`\r\nto get \"versions\"\r\nUse `echo phpversion();`\r\nto get PHP version.\r\n\r\nSome issues can depends on your context, settings,\r\nmacros, timezone, language. So to be sure the code\r\nyou give is enough to reproduce your bug, try it\r\nfirst in:\r\nhttps://try-carbon.herokuapp.com/?theme=xcode&export&embed\r\n\r\nYou can use the [Options] button to change the version\r\nthen when you get the bug with this editor, you can use\r\nthe [Export] button, copy the link of the opened tab,\r\nthen paste it in the issue. Then we can immediatly get\r\nyour issue.\r\n-->\r\n\r\nI expected to get:\r\n```\r\n2 days\r\n```\r\n<!--\r\nAlways give your expectations. Each use has their owns.\r\nYou may want daylight saving time to be taken into account,\r\nsomeone else want it to be ignored. You may want timezone\r\nto be used in comparisons, someone else may not, etc.\r\n-->\r\n\r\nBut I actually get:\r\n```\r\n1 day\r\n```\r\n<!--\r\nIf you did not succeed to get the same result in\r\nhttps://try-carbon.herokuapp.com/ then precise the\r\nresult you get.\r\n-->\r\n\r\nThis code worked fine on PHP7.1 but when I updated to 7.2 I have to add an extra 1 second to make it work: `new DateTime('+2 days 1 second')` works as expected.\r\nIt looks like there is incompatibility between these 2 PHP versions.\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/briannesbitt/Carbon/issues/comments/445809929","html_url":"https://github.com/briannesbitt/Carbon/issues/1544#issuecomment-445809929","issue_url":"https://api.github.com/repos/briannesbitt/Carbon/issues/1544","id":445809929,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTgwOTkyOQ==","user":{"login":"kylekatarnls","id":5966783,"node_id":"MDQ6VXNlcjU5NjY3ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/5966783?v=4","gravatar_id":"","url":"https://api.github.com/users/kylekatarnls","html_url":"https://github.com/kylekatarnls","followers_url":"https://api.github.com/users/kylekatarnls/followers","following_url":"https://api.github.com/users/kylekatarnls/following{/other_user}","gists_url":"https://api.github.com/users/kylekatarnls/gists{/gist_id}","starred_url":"https://api.github.com/users/kylekatarnls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kylekatarnls/subscriptions","organizations_url":"https://api.github.com/users/kylekatarnls/orgs","repos_url":"https://api.github.com/users/kylekatarnls/repos","events_url":"https://api.github.com/users/kylekatarnls/events{/privacy}","received_events_url":"https://api.github.com/users/kylekatarnls/received_events","type":"User","site_admin":false},"created_at":"2018-12-10T13:11:27Z","updated_at":"2018-12-10T13:11:27Z","author_association":"COLLABORATOR","body":"No read the whole explanation, the solution is not `addDays`, the solution is using a common `$now` reference."}}
{"actor":{"display_login":"kylekatarnls"}}