Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
hi,
I upgraded to voting api 2.8 and had to disable voting rules as cron would not run any more.
Drush throws out this PHP error:
PHP Fatal error: Class name must be a valid object or a string in includes/common.inc on line 7679
Comment | File | Size | Author |
---|---|---|---|
#12 | 1810836-vr-bulk-11.patch | 530 bytes | andypost |
#9 | 1810836_9_voting_api_upgrade_fix.patch | 482 bytes | szantog |
#2 | voting_rules.module.txt | 4.69 KB | adam_b |
Comments
Comment #1
vloo CreditAttribution: vloo commentedIt seems that the author forgot to implement hook_entity_info()...
Use this code:
I added it to voting_rules.module and now it works fine :)
Comment #2
adam_b CreditAttribution: adam_b commentedvloo, thanks for your comment on #1810474: Ajax error with Advanced Poll - but I've tried your fix and I'm still getting the same error.
I've attached the updated voting_rules.module file, where I've added the code above from line 52 - could you check if I've got it right? (The .txt file extension is just so it can be uploaded here.)
many thanks.
Comment #3
vloo CreditAttribution: vloo commentedYep, that's the thing. Only difference between yours and mine is that I got it in the bottom, but this shouldn't matter...
It's version = "7.x-1.0-alpha1"
I got Voting API version = "7.x-2.9"
Drupal 7.16
Try disabling some modules in order to see if anything other is messing with the voting rules... I can't get any other idea why this is not working for you :/
Comment #4
mermemladeK CreditAttribution: mermemladeK commentedSame problem and version than adam_b.
Vloo: your solution is not working for me either. Do I have to wait some time?
Comment #5
adam_b CreditAttribution: adam_b commentedTried moving that code to the end of voting.rules.modules, and I got a WSOD with the message:
Tried uninstalling the module and reinstalling with the new code, and it appeared to install in a working state, but with a warning message (repeated 3 times):
Warning: array_keys() [function.array-keys]: The first argument should be an array in drupal_schema_fields_sql() (line 6899 of /homepages/31/d292789962/htdocs/theparentzone/includes/common.inc).
As above, this didn't fix the 200 error.
Checked the Status report and found this:
but that didn't look very relevant and I couldn't find a way to edit the tokens short of editing code.
Tried removing all the modules except Advanced Poll, Voting API and Voting Rules - same 200 error.
Tried starting on a new site from scratch, using only the minimal modules needed to test this (advpoll, date, entity, rules, voting_rules, votingapi) and when I tried to enable the patched Voting Rules module, I got the same WSOD error as above.
So... no luck yet :(
Comment #6
mustername CreditAttribution: mustername commentedthx vloo, works for me with
Rules 2.2
Voting API 2.9
and Drupal 7.16
I do get a warning 'array_keys() expects parameter 1 to be array, null given common.inc:6899' though.
Comment #7
mermemladeK CreditAttribution: mermemladeK commentedI solved it by disabling and enabling the Voting rules module.
Comment #8
bobrock CreditAttribution: bobrock commentedI solved in this way:
Without cron run it didn't work for me
Comment #9
szantog CreditAttribution: szantog commentedI'm sure, the _entity_info is not necessary. Why should have the voting rules own entity? It uses the rules api.
As I see, the votingapi makes changes (or could be a full new feature) when deleting orphaned votes. If this happens, the delete vote event is fired. But this orphaned deleting is a bulk operations, so doesn't contains the entity_type and entity_id, which are used in voting_rules_load_entity().
I'm not sure, this is the perfect solution, because when I fixed it my own, the orphaned votes was deleted, and never could catch this orphaned deleting process again. The fact, when the rule was fired by an orphaned deletion, the $entity_type and $entity_id was NULL.
Comment #10
szantog CreditAttribution: szantog commented@bobrock
Yes, this solves the issue temporary. When you run cron without voting_rules, the orphaned votes was deleted as well by votingapi. But the next time, when the votingapi will try delete these again, the error will get back.
Comment #11
andypostI think this should use empty() so no reason to load entities without type
Comment #12
andypostsecond argument should be checked with
is_null()
because of UID=0Comment #13
rodpal CreditAttribution: rodpal commented@andypost
Rules 2.2
Voting API 2.9
and Drupal 7.16
I still get the ajax error:
Notice: Undefined index: form_build_id en ajax_get_form() (línea 320 de C:\xampp\htdocs\vepormas\includes\ajax.inc).
Comment #14
kappaluppa CreditAttribution: kappaluppa commented#1 worked for me. But I also turned off voting rules, ran cron turned it back on. Still had the error. Added the info from #1 and now I don't get the error. Thanks vloo.
drupal 7.22
Advanced Poll 7.x-3.x-dev
Voting API 7.x-2.11
Voting Rules 7.x-1.0-alpha1
Rules 7.x-2.2
so far, so good...
Comment #15
cchoudhary CreditAttribution: cchoudhary commentedTried all of above mentioned solutions, nothing worked for me, Still getting same error. can please someone help , need it urgent.
drupal 7.24
Advanced Poll 7.x-3.x-dev
Voting API 7.x-2.11
Voting Rules 7.x-1.0-alpha1
Rules 7.x-2.6