Fatal Error when editing month view

orbface9 - November 24, 2008 - 16:59
Project:Calendar
Version:6.x-2.0-rc5
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

When editing the month view, i tried to click the "Change settings for this style" button and i got a javascript popup.

Fatal error: Unsupported operand types in /var/www/vhosts/calendarofohio.com/httpdocs/sites/all/modules/calendar/includes/calendar_view_plugin_style.inc on line 119

I looked at the file and came up with a fix.

I changed line 119 from:

<?php
'#options' => $field_options + $date_field_options,
?>

to this:
<?php
'#options' => is_array($field_options) && is_array($date_field_options)?$field_options + $date_field_options:is_array($field_options)?$field_options:is_array($date_field_options)?$date_field_options:'',
?>

Basically, i am just checking to see which if any of the two variables are arrays, and adding those values accordingly.

It is up and running now for me.

Also, just a side note. I recently upgraded from rc4 to rc5, so that may have contributed to my problem.

#1

orbface9 - November 24, 2008 - 20:22
Status:active» needs review

Created a patch, it's attached.

AttachmentSize
calendar_view_plugin_style.patch 938 bytes

#2

orbface9 - November 24, 2008 - 20:22

Created a patch, it's attached.

#3

paul.lovvik - November 24, 2008 - 22:30
Priority:normal» critical

This is a good catch. I am able to reproduce the problem as well. I rerolled the patch to break the long line into a function that helps make it more self-explanatory.

I changed the priority to critical because the functionality is broken without this patch.

AttachmentSize
338515_3.patch 1.89 KB

#4

KarenS - November 25, 2008 - 16:22
Status:needs review» fixed

Even easier yet, just initialize $date_field_options = array(), which should have been in there. Which is what I have just committed.

I forgot to credit you guys in the commit, but thanks for the detective work!

#5

System Message - December 9, 2008 - 16:22
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.