Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70590 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40575 invoked from network); 11 Dec 2013 12:50:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2013 12:50:35 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:41743] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/42-22966-99F58A25 for ; Wed, 11 Dec 2013 07:50:34 -0500 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 49C9AE203A; Wed, 11 Dec 2013 12:50:31 +0000 (GMT) Date: Wed, 11 Dec 2013 12:50:31 +0000 (GMT) X-X-Sender: derick@whisky.home.derickrethans.nl To: Nikita Nefedov cc: "internals@lists.php.net" In-Reply-To: Message-ID: References: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] timelib diff working wrong on with years From: derick@php.net (Derick Rethans) On Wed, 11 Dec 2013, Nikita Nefedov wrote: > On Wed, 11 Dec 2013 14:13:07 +0400, Derick Rethans wrote: > > > On Wed, 11 Dec 2013, Nikita Nefedov wrote: > > > > > today I stumbled upon this bug, but I actually don't know should I > > > call it bug or is it right behavior? > > > > > > So for example lets get diff between 2013-10-25 and 2014-10-25: > > > var_dump((new DateTime("2013-03-25"))->diff(new > > > DateTime("2014-03-25"))) > > > > > > We'll get one full year. > > > > > > Then if we try to get diff between 2012-03-25 and 2013-03-25 we'll > > > also get one year. > > > > > > But if we have 2012-03-01 and 2013-03-01 then we get 11 months and > > > 30 days (365 in int->days member)... > > > > > > Should we consider this as a bug or not? > > > > I did some fixes for this already - which version of PHP is this? > > I can reproduce this on 5.5.7RC1 tag. (can't check it on the other > versions at the moment) Please file a bug. I'll try to get at it at the weekend (don't you love christmas hacking time!) cheers, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug Posted with an email client that doesn't mangle email: alpine