Hi,

when rating an item with the five star plugin I get a popup with the following error message:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Internal Server Error
ResponseText: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1: INSERT INTO {field_data_field_published_in} (entity_type, entity_id, revision_id, bundle, delta, language, field_published_in_url, field_published_in_title, field_published_in_attributes) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, ); Array
(
[:db_insert_placeholder_0] => node
[:db_insert_placeholder_1] => 1609
[:db_insert_placeholder_2] => 1609
[:db_insert_placeholder_3] => review
[:db_insert_placeholder_4] => 0
[:db_insert_placeholder_5] => und
[:db_insert_placeholder_6] => http://www.tandf.co.uk/journals/titles/13675567.asp
[:db_insert_placeholder_7] => International Journal of Logistics Research and Applications
)
in field_sql_storage_field_storage_write() (line 448 of /some/path/field_sql_storage/field_sql_storage.module).

Any hints?

Daniel

Files: 
CommentFileSizeAuthor
#18 fivestar-ajax-error.1393812.patch937 bytesericduran
PASSED: [[SimpleTest]]: [MySQL] 115 pass(es).
[ View ]

Comments

ChrisNelson’s picture

Getting the same error Chrome and Firefox
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Service unavailable (with message)
ResponseText: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1: INSERT INTO {field_data_field_widget_link} (entity_type, entity_id, revision_id, bundle, delta, language, field_widget_link_url, field_widget_link_title, field_widget_link_attributes) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, ); Array
(
[:db_insert_placeholder_0] => node
[:db_insert_placeholder_1] => 6842
[:db_insert_placeholder_2] => 6841
[:db_insert_placeholder_3] => contributed_widgets
[:db_insert_placeholder_4] => 0
[:db_insert_placeholder_5] => und
[:db_insert_placeholder_6] => http://google.com/
[:db_insert_placeholder_7] => http://google.com/
)
in field_sql_storage_field_storage_write() (line 448 of /some/path/modules/field/modules/field_sql_storage/field_sql_storage.module).

[update] when I remove the iFrame content from the page it works fine possible conflict with the insertFrame module or something with the iFrame itself

[update2] no error when just using a regular iFrame so must be a conflict with something the insertFrame module is doing.

[update3] does not have to do with insertFrame error occurs if there is a link field that has a value in the node. If you have a link field and that field has a value this ajax error will happen, remove the link field value error will go away. Does anyone know if this is a core ajax handling issue or if fivestar is doing something wrong?

[update4] related http://drupal.org/node/1055772 looks like Fivestar calls
field_attach_update($entity_type, $entity);
without 'cleaning the data' causing the error in field_sql_storage.module

[update5] anyone looking for a temp fix for this can unset the offending field before the call to
field_attach_update($entity_type, $entity); on line 155 of fivestar.field.inc
in my case
unset($entity->field_widget_link);

dimon00’s picture

Same error here with last dev version.

the [update5] with the unset workaraound works for me too.

Thank you.

InTheLyonsDen’s picture

I am battling the same issues here... Users are not able to vote. I tried the fix suggested by ChrisNelson and I was able to get one vote from a user but the next user received the error. These were test users in difference browsers. I have tried placing the unset above and below the field_attach_update. Is my syntax correct?

function _fivestar_update_field_value($entity_type, $entity, $field_name, $langcode, $value) {
  $entity->{$field_name}[$langcode][0]['rating'] = $value;
  unset($entity->field_widget_link);
  field_attach_update($entity_type, $entity);
}

and

function _fivestar_update_field_value($entity_type, $entity, $field_name, $langcode, $value) {
  $entity->{$field_name}[$langcode][0]['rating'] = $value;
  field_attach_update($entity_type, $entity);
  unset($entity->field_widget_link);

}

Any thoughts? Thanks Kevin

ericduran’s picture

I'm looking into this. Sorry for any issues this might have caused :(

zilla’s picture

i'm seeing this as well - but here's what's strange: i got the error, so i went back to the content type and changed the type of star and updated, then went back and votes worked on existing nodes with five star BUT when i created a new node, the new node spat back the error. odd.

btw, how would a non programmer go about implementing the (unset) change to that line - or does somebody know if that's already rolled into the most recent dev version?

zilla’s picture

update: i'm seeing this now only in nodes that have link fields as well.

dimon00’s picture

Zilla: something strange is happening when using fivestar and link field in the same node: I was forced to strip field link from my nodes. :(

http://drupal.org/node/1448298

zilla’s picture

yeah, same thing - i noticed that it was actually removing any links from the node and when clicking "edit" any links entered in link field were now gone, at which point five star worked again...i had to remove link field from two node types and replace with a text box to insert links, which is okay but not as nice ;)

ericduran’s picture

This is weird, because I don't modified the link field.

zilla’s picture

it is really strange because link field should be entirely unrelated, but there's something exposed in link field that's causing this (or in five star), and it happens at save page (the event when information gets stored in an edit) as well as in display (when five star votes are enabled in field widget, they can spit back this error but don't alter links, the links field gets altered when the node state is changed)

cssdru’s picture

Hi there,

I am using fivestar and link field in the same nodetype and facing the same problem after upgrading from Drupal6 to Drupal7.

Any solution out there?

zilla’s picture

Title:AJAX / SQL error» AJAX / SQL error - one solution

so, my solution was a bit of a hack: i simply removed the "link field" and instead used a text box set to plain text filter (which converts URL to link, though quirky on my own site right now) - you can then use "better formats" module to hide the whole inputs instructions text that appears on a text box

basically, it will look the same, but if you want to incorporate the link field into views just remember that you're not using the link field anymore!

cssdru’s picture

Thank you Zilla for your suggested solution. But, the problem is that I have already content using link_field. I am wondering what's going wrong with link & Fivestar in Drupal 7.

zilla’s picture

i have no idea, but i'd personally love to see a strong fix so that i can go back to using it the logical way (i like managing links in links fields with optional titles/descriptions for tons of reasons - and rating in some situations is absolutely critical, so i need both on the same node!)

ericduran’s picture

Yea, I'm looking into this issue.

I'm testing fivestar and link. I should have a fix for this hopefully soon.

Konstantin Boyandin’s picture

Confirming the AJAX problem with a content type with link field used.
The last Fivestar 7.x-2.x-dev

jthomasbailey’s picture

Priority:Major» Critical

Worse than that, it erases all the data from the field_data_field_link table when the node is given a star rating! I think you just need to change the "bundle" name to something other than "Link". On the bright side, once it erases all the Link module's data it seems to work.

ericduran’s picture

Status:Active» Needs review
StatusFileSize
new937 bytes
PASSED: [[SimpleTest]]: [MySQL] 115 pass(es).
[ View ]

Ok, lets see if this passes the test.

But I'm also going to try and see if I can add a test for this.

ericduran’s picture

Status:Needs review» Fixed

Ok. this looks good to me. I'm going to commit this.

This should fix all the ajax problems.

Thanks all for the help.

--
http://drupalcode.org/project/fivestar.git/commit/3b66a82

jthomasbailey’s picture

yep I think that did it!

ericduran’s picture

Status:Fixed» Active

Opening this back up again because of #1503086: voting kills Image field

ericduran’s picture

Status:Active» Fixed

Ok this is now properly fixed, sorry for any issues this might have caused.

--
http://drupalcode.org/project/fivestar.git/commit/46a196d62aacd430523161...

Status:Fixed» Closed (fixed)

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

joya’s picture

seems not to be solved,
I'm getting AJAX 500 Error with Drupal 7.12 and Fivestar 7.x-2.0-alpha2
again.

See my Post: http://drupal.org/node/1546878

velpan’s picture

I'm getting the Ajax 500 error while trying to "Retroactive update" filenames in a content type with fivestar & link fields. After the error the link field loses its value.

Drupal 7.14, Fivestar 7.x-2.0-alpha2+5-dev

Berliner-dupe’s picture

Issue summary:View changes
Status:Closed (fixed)» Active

When i use this patch all Node-Images are deleted when i make a Fivestar-Rating. Whether guest, registered user or admin rate ....

Has anyone an idea?

whiteph’s picture

Status:Active» Postponed (maintainer needs more info)

There's quite a history in the comment chain, it's not clear what Fivestar configuration has the issue. Please give a list of things I can do to reproduce the problem - both the "raw" link form and the "image" form.

But first, please test with the 7.x-2.0-beta1 version, which has about twenty fixes since the last comment on this issue - including in the function mentioned.

whiteph’s picture

Priority:Critical» Normal