Hello, we recently installed the 5.x-2.0-rc calendar on a development site. There is an error message showing up above the calendar, viewable at http://pricold.sundaysenergy.org/calendar
The warning is:
warning: date_create() expects parameter 2 to be DateTimeZone, string given in /home/ecogard/public_html/sites/all/modules/calendar/calendar.inc on line 576.
warning: date_format() expects parameter 1 to be DateTime, boolean given in /home/ecogard/public_html/sites/all/modules/calendar/calendar.inc on line 577.
warning: date_create() expects parameter 2 to be DateTimeZone, string given in /home/ecogard/public_html/sites/all/modules/calendar/calendar.inc on line 578.
warning: date_format() expects parameter 1 to be DateTime, boolean given in /home/ecogard/public_html/sites/all/modules/calendar/calendar.inc on line 579.
warning: date_create() expects parameter 2 to be DateTimeZone, string given in /home/ecogard/public_html/sites/all/modules/calendar/calendar.inc on line 576.
warning: date_format() expects parameter 1 to be DateTime, boolean given in /home/ecogard/public_html/sites/all/modules/calendar/calendar.inc on line 577.
warning: date_create() expects parameter 2 to be DateTimeZone, string given in /home/ecogard/public_html/sites/all/modules/calendar/calendar.inc on line 578.
warning: date_format() expects parameter 1 to be DateTime, boolean given in /home/ecogard/public_html/sites/all/modules/calendar/calendar.inc on line 579.
I'm wondering why this is and what can be done about it.
Thanks for your help,
Jim
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | date-create.patch | 1.6 KB | johnalbin |
| #5 | calendar.inc_.diff.txt | 1.52 KB | webmasterkai |
Comments
Comment #1
hhg commentedI see the same warnings running on PHP 5.2.5. On PHP 4.3.11 it works.
As the warning says, the date_create takes a DateTimeZone as parameter 2, but the date_php4.inc emulation code states:
@param string $timezone
* PHP 5 uses a timezone object, in PHP 4 use a timezone name.
So the solutions could be a thin timezone object in the date_php4 emulation code, so the date_create function gets the same signature regardless of PHP version
Comment #2
geek-merlinsame problem here. subscribing.
Comment #3
geek-merlini get these errors when i display a calendar block showing event.module events.
here's the problem code (same as in HEAD)
changing both occurences of 'UTC' to new DateTimeZone('UTC') according to the spec makes the errors go away here.
Comment #4
geek-merlin...but after that i get new errors.
# warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in /www/htdocs/konzep/z/sites/all/modules/calendar/calendar.inc on line 628.
# warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in /www/htdocs/konzep/z/sites/all/modules/calendar/calendar.inc on line 629.
the offending codeblock is:
some debugging tells me there are actually 2 different bugs here. see also: #239059: Timezone map in date_php4_tz_map.inc probably wrong
solution: change $timezone to new DateTimeZone($timezone)
after changing this (2 lines in #3, 2 lines in #4) everything works here for me.
Comment #5
webmasterkai commentedThanks for the help. It works for me. I've attached a patch.
Comment #6
bcn commentedsubscribing...
Comment #7
johnalbinThe patch in #5 is reversed. Also we should be using
timezone_open()instead ofnew DateTimeZonein order to keep compatibility with date_php4.module.Here’s the correct patch.
Comment #8
johnalbinComment #9
bcn commentedPatch from #7 applies and seems to fix the bug (ie the warning are gone).
btw, I'm on PHP 5
Comment #10
kimadactyl commentedPatch #7 works for me! PHP 5.
Comment #11
choster commentedPath #7 resolves the issue of event nodes not appearing in the calendar, and of the PHP parameter errors in the logs. We are on PHP 5.2.5. Unfortunately, everything displays 8 time zones or so off.
Comment #12
karens commentedFixed slightly differently (using date_make_date instead of date_create). Thanks for catching this!
Comment #13
wouter99999 commentedHi,
When implementing a calendar, I got a lot of these watchdogs warnings (50000+) when clicking on a link in the mini calender. After a while I found out that it was caused by having two calendar views enabled by mistake.
Anyone having this problem: make sure you have only one calendar view enabled in your views.
Wouter
Comment #14
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #15
Goose4all commentedi get the same error but without having 2 calendar views?
i'v just installed both 2.x-dev versions (calendar and date) and if i enable the calendar view and wanna visit the /calendar site, the watchdog gets filed with millions(!! -i am not kidding.. i need to kill the sql-process) of these messages
<em>date_format() expects parameter 1 to be DateTime, null given</em> in <em>/var/www/www.trekking-blog.de/modules/calendar/calendar.inc</em> in Zeile <em>160</em>.about row 160 of calendar.inc is:
function calendar_build_calendar($view, $items, $params) {// Remove nodes outside the selected date range.
$values = array();
foreach ($items as $delta => $item) {
if (($item->calendar_start_date >= $view->min_date && $item->calendar_start_date <= $view->max_date)
|| ($item->calendar_end_date >= $view->min_date && $item->calendar_end_date <= $view->max_date)) {
$values[date_format($item->calendar_start_date, 'Y-m-d')][date_format($item->calendar_start_date, 'Y-m-d')][] = $item; <-- this is row 160 -->
}
}
i get this error for ~ 10 rows..
how can we get this fixed? it doesnt work at all...
Comment #16
Goose4all commentedups.. wrong status set..
Comment #17
karens commentedDon't reopen an old closed issue with different information. Your message does not have the same cause nor is it the same issue. I need lots more information to know why you're getting that message. Open a new issue and start over by telling me what kind of date you're using, provide an export of your view, and describe where you get the error.
Comment #18
karens commentedComment #19
dugh commentedI see the same issue as originally reported when adding the calendar block, using the latest dev version of date & calendar. I already have overridden the calendar view to add a date field (to prevent a bigger bug).
date_format() expects parameter 1 to be DateTime
on lines: 821 & 126
Comment #20
richard.e.morton commented* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/nafof.org.uk/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/nafof.org.uk/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/nafof.org.uk/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/nafof.org.uk/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/nafof.org.uk/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/nafof.org.uk/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/nafof.org.uk/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/nafof.org.uk/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
given with Calendar and Date 2.1 on D6
R
Comment #21
jferjan commentedsubscribing
Comment #22
phils-okc commentedwarning: date_timezone_set() expects parameter 1 to be DateTime, null given in /Applications/MAMP/htdocs/drupal/sites/all/modules/date/date_api_ical.inc on line 568.
warning: date_format() expects parameter 1 to be DateTime, null given in /Applications/MAMP/htdocs/drupal/sites/all/modules/date/date_api_ical.inc on line 654.
warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /Applications/MAMP/htdocs/drupal/sites/all/modules/date/date_api_ical.inc on line 568.
warning: date_format() expects parameter 1 to be DateTime, null given in /Applications/MAMP/htdocs/drupal/sites/all/modules/date/date_api_ical.inc on line 654.
Every thing seams to be saving correctly. My new nodes show up in the all the calendar views including "upcoming".
I'm not sure how to test the ical module. But I get this error whether or not the module is enabled. I have run through the troubleshooting checklist with the iCal module enabled and disabled.
Running php 5.2.6
March 26 dev version of Calendar
March 27 dev version of Date
Cleared all caches and double-checked all date fields and re-saved.
Thanks
Comment #23
arlinsandbulte commentedPlease, as Karen said, don't open old issues with NEW information. These are not the same issues originally reported.
#20 might be a duplicate of this #417626: Date browser and Calendar works but show errors
#22 is a duplicate of #409476: date_timezone_set() & date_format() error when editing CCK date repeating fields.
Comment #24
richard.e.morton commentedHi Thanks for your reply.
Firstly saying that "as Karen said", I am sorry I dont read every thread on here. it just isn't reasonable to expect that we all do do that. Also different modules have different rules with regard to re-opening threads, I have been told off for not re-opening threads.... you just can't win.
Richard
Comment #25
MikeBC commented/subscribe
Comment #26
avpadernoIt is useless to subscribe to a report that has been closed. :-)
Comment #27
Nagi21 commentedwarning: date_timezone_set() expects parameter 1 to be DateTime, null given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\sites\all\modules\calendar\includes\calendar.inc on line 417.
warning: date_format() expects parameter 1 to be DateTime, null given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\sites\all\modules\calendar\includes\calendar.inc on line 419.
warning: date_timezone_set() expects parameter 1 to be DateTime, null given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\sites\all\modules\calendar\includes\calendar.inc on line 417.
warning: date_format() expects parameter 1 to be DateTime, null given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\sites\all\modules\calendar\includes\calendar.inc on line 419.
i am getting this error....
Comment #28
karens commented#24 Don't reopen reports if you haven't read all the way through them. If you can't be bothered to even read through the issue to see if it's the right one and whether there is already a solution suggested, you're wasting everyone's time.
#27 As said in #17 and #23, don't reopen an old closed report for this. The code has changed drastically in the year since this report was filed so there's no possible way it can be the same thing. And you need to provide a lot more information than an error message, like what you are doing when you see the message, what version you are using, what environment you have, what kind of date field you're using, how your view is set up, etc.
Comment #29
epop commentedany solution for this ical error? #22
Comment #30
tlangston commentedAm getting the same error here. Have gone thru all troubleshooting steps and nothing corrects the problem. I reported also under Date API thread thinking this is related.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/theatricalsinger.com/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
* warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/theatricalsinger.com/httpdocs/sites/all/modules/calendar/includes/calendar.inc on line 416.
This error is preventing me from accessing date/time config settings and other areas of admin - I ran some tests by turning off this module and was able to get admin functions back so I think it is related. I'm getting a blank page and the log is spitting out the following:
[Wed Jun 10 07:37:49 2009] [error] [client 65.19.75.254] PHP Fatal error: Cannot call overloaded function for non-object in /var/www/vhosts/theatricalsinger.com/httpdocs/includes/module.inc on line 128, referer: http://theatricalsinger.com/user/1
Comment #31
duckydan commentedI am having this same error, but only when I am not logged in. If logged in, it's fine. Please excuse my stupidity, but it seems like an anonymous user needs a "default" time zone and is not getting the one from the date API.
Comment #32
duckydan commentedComment #33
arlinsandbulte commentedThis issue (issueS, really) has been closed and opened and closed and opened too many times to be of any use any more.
DO NOT REOPEN THIS ISSUE
If you think you are having a similar issue, open a new issue and describe your issue in detail there.
Thanks.