Fatal error: Unsupported operand types (fivestar.module) line 1089

Jaani - December 22, 2007 - 02:30
Project:Fivestar
Version:5.x-1.11-beta2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Once a fivestar CCK field has been added to any node type, any new nodes (or edits to existing nodes) result in the following error PHP error message being displayed upon clicking the 'submit' or 'preview' buttons:

Fatal error: Unsupported operand types in /home//public_html//modules/fivestar/fivestar.module on line 1089

Steps to reproduce:

  • Activate the Fivestar module
  • Add a new node type
  • Add a new fivestar rating field (star or radio, doesn't seem to matter)
  • Whether clearing is allowed, whether required or optional, and number of stars don't seem to matter
  • Create a new node of that type and try to set a rating
  • Click submit

Other background information:

  • Theme: Garland stock (no changes to template.php file at all)
  • Drupal version: 5.5
  • Fivestar version: 1.11 beta 1(latest release)
  • Widget: default (I changed the .gif files)

Working hypothesis:

Line 1089 occurs in a theme function. Have I done something to mess up the widget display? I'm running quite a few other modules -- could one of these be interfering with fivestar? Interestingly, since upgrading to the 1.11 version, voting didn't work (whether radio/select or AJAX stars) unless I installed the JQuery_update module. Is this a common, possibly related issue?

#1

quicksketch - December 22, 2007 - 06:38

Thanks! I think this might have been caused by a change in VotingAPI, but I'm not positive. Did you update your VotingAPI module at the same time?

I've updated the CCK implementation to work with this update and it should be working again now in the latest 1.x dev version (but it's not in beta2). The 1.11 version is seeing a lot of bugs (and fixes) because it changes a lot of the basic functionality of fivestar. So we're rolling with beta releases for this version.

The jQuery_update requirement is fixed in beta2 so it should work with or without it now.

#2

quicksketch - December 22, 2007 - 07:33

Marking fixed, but please let me know if you updated votingapi at the same time. Thanks!

#3

quicksketch - December 22, 2007 - 07:39
Status:active» fixed

#4

Jaani - December 22, 2007 - 08:31

Many thanks quicksketch. I replaced fivestar.module with version 1.2.2.54, fivestar_field.inc with version 1.1.4.10 and jquery.rating.js with version 1.2.2.25. This appears to have fixed the unsupported operand error, so this node can be marked as fixed.

However... it now appears (and maybe this is a related issue) that CCK votes are not saved. Previewing a rating submission will display the correct number of stars in the field, but upon submission the field reverts to its previous (null) value. I've tried various combinations of files in the dev-1.x CVS tree but can't get it working.

Regarding VotingAPI, I am using votingapi.module version 1.40.2.5, which I did not update prior to upgrading to the 1.11 dev release of fivestar. I'll try this now. (I'm still fairly new to Drupal so this could well be user error.)

#5

quicksketch - December 22, 2007 - 09:09
Status:fixed» active

Ah. I took the totally wrong approach at correcting the problem. Thanks for the excellent follow-up. It turns out the field was submitting an array rather than a single value like it should have been. I corrected this and committed it the latest dev version again. This all stemmed from the massive restructuring of the form elements in 1.11, which is also the reason for beta versions this time around. It's pretty big change that (as you can see) has broken a lot of things.

If you're just wanting to get Fivestar running on your site, the 1.10 final version is much more stable. But I'd love if you stick around and help hammer out the issues in 1.11. :)

I'm leaving open now because this might yet have other implications. Let me know if the rating through CCK seems to be broken in any other ways. Thanks!

#6

Jaani - December 24, 2007 - 06:10

Hi again quicksketch. Thanks for the followup -- I think we're almost there. Votes are now being saved from the CCK field. However, a related bug seems to have appeared since the last commit. Here's a brief description:

  • A content type is configured to allow users to vote on nodes (ie, 'simple' fivestar operation)
  • The star display style is set to 'user vote if available, otherwise average' (essentially mimicking Amazon product reviews)
  • A user votes on such a node and the stars update to show the node; the average is correctly updated
  • The page is refreshed
  • Problem: stars display as if no users have voted; ie, there are no filled in stars
  • (If users can undo their votes then no stars are displayed, otherwise it defaults to 1 star regardless of the user's actual vote -- which *is* recorded correctly, since the average text, which is displayed below the stars, updates correctly)
  • CCK field operation seems to be correct

Version information

  • fivestar.module 1.2.2.56
  • jquery.rating.js 1.2.2.27
  • fivestar_field.inc 1.1.4.11

No further changes to votingapi configuration have occurred since this issue was first posted.

Any suggested fixes would be fantastic. Keep up the great work on this otherwise excellent module!

#7

nehalmehta - January 9, 2008 - 23:34

I am too having same problem. FiveStar CCK are added well but when we submit content type, in display of that content type Fivestar cck appears as if nothing has been voting. And when we edit that content type somehow value of that fivestar cck comes to "Cancel Rating"

If anybody has solution to this please let us know, so that we can fully utilise this really useful module.

Thanks,
Nehal Mehta.

#8

twright - January 10, 2008 - 01:51
Version:5.x-1.x-dev» 5.x-1.11-beta2

Hello, I'm pretty sure I'm having the exact same problem as mentioned earlier. Problem is that I just downloaded the latest version tonight and started messing with it. I quickly figured out that the theme_fivestar_static function was being shipped an array so I fixed that, and now I'm seeing my stars showing 0 out of 5. I started looking further into the code when I decided that I should just check on here. It seems like the messages above show that its getting close. Is there a way I could get the latest version? fivestar.module 1.2.2.56 or could someone point me to it?

#9

quicksketch - January 14, 2008 - 03:10
Status:active» fixed

Problem: stars display as if no users have voted; ie, there are no filled in stars

I duplicated this problem in beta2 and it should be fixed in the latest CVS. I'll release beta3 shortly to let everyone get a fresh shot at testing.

#10

Anonymous (not verified) - January 28, 2008 - 03:12
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.