{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"open","user":{"avatar_url":"https://secure.gravatar.com/avatar/156a0846547a9058cf9b61056f0bc6c1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"156a0846547a9058cf9b61056f0bc6c1","url":"https://api.github.com/users/barlow","login":"barlow","id":591677},"milestone":null,"assignee":null,"updated_at":"2011-11-10T07:58:53Z","labels":[],"closed_at":null,"comments":4,"url":"https://api.github.com/repos/tplaner/When/issues/5","body":"With an RRULE such as: \r\n\r\nFREQ=MONTHLY;\r\n\r\nmy production version of PHP (5.2.13) was throwing an exception because of code at around line 630. The message was:\r\nWarning: DateTime::modify() [datetime.modify]: Failed to parse time string (last day of 1 month) at position 9 (o):\r\n\r\nThe offending line of code was:\r\n$this->try_date->modify('last day of ' . $this->interval . ' ' . $interval);\r\n\r\nI believe this version of PHP could not understand 'last day of'.\r\n\r\nNow, I'm not sure what the intent of the code was here, but I'm assuming you are wanting to move the date ahead a certain (interval) number of months, landing on the last day of the month. My solution was:\r\n\r\nfor ($i=0; $i< $this->interval; $i++)\r\n{\r\n\t$this->try_date->modify('+ 28 days');\r\n\t$this->try_date->setDate($this->try_date->format('Y'), $this->try_date->format('m'), $this->try_date->format('t'));\r\n} \r\n\r\nThe +28 days ensure we dont skip a smaller month, and the format('t') gives us the last date of the month in question.","html_url":"https://github.com/tplaner/When/issues/5","title":"Exception causing trouble in PHP 5.2.13","number":5,"id":562837,"created_at":"2011-01-30T20:27:47Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/98a6ebb597b2fab471a2d3e514024cf8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"98a6ebb597b2fab471a2d3e514024cf8","url":"https://api.github.com/users/freshface","login":"freshface","id":103913},"updated_at":"2011-11-10T07:58:53Z","url":"https://api.github.com/repos/tplaner/When/issues/comments/2692504","body":"It fixes it, thx.\r\n","id":2692504,"created_at":"2011-11-10T07:58:53Z"}}