"An HTTP error 200 occurred." when trying to flag a node in a Views table

Matt V. - April 13, 2009 - 01:20
Project:Flag
Version:6.x-1.1
Component:Views integration
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

I have a table view with an flag link for each node. When I try clicking on one of the links, I get a javascript pop-up with an error message that says "An HTTP error 200 occurred..." followed by a long URL that ends in a &token= value.

#1

jacobthetopdawg - April 15, 2009 - 20:19

I'm experiencing the same error using IE 8 when trying to flag content. Any ideas anyone?

#2

mooffie - April 16, 2009 - 03:30
Status:active» postponed (maintainer needs more info)

When "An HTTP error 200 occurred..." shows up it usually because of some PHP error on your site. (One other possible reason: doing a page redirection upon flagging.)

To see the actual PHP error, open the link in a new window (or tab).

In other words:

Don't click the flag link with your left mouse button. Instead, click it with your right mouse button. Then, using the context menu, open the link in a new tab/window. The page you'll see will probably reveal something about why the error occurred. Please report back the result.

#3

Matt V. - April 16, 2009 - 04:27

It looks like it might be a Views issue:

user warning: 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 'AND flag_content_users.uid = 1) LEFT JOIN flag_content flag_content_node ON nod' at line 5 query: SELECT node.nid AS nid, node.title AS node_title FROM node node INNER JOIN users users ON node.uid = users.uid INNER JOIN flag_content flag_content_users ON users.uid = flag_content_users.content_id AND (flag_content_users.fid = AND flag_content_users.uid = 1) LEFT JOIN flag_content flag_content_node ON node.nid = flag_content_node.content_id AND (flag_content_node.fid = AND flag_content_node.uid = 1) in /path/sites/all/modules/views/includes/view.inc on line 735.

#4

mooffie - April 16, 2009 - 05:45

AND (flag_content_users.fid = AND
...
AND (flag_content_node.fid = AND

Note that the 'fid' on the right side of the "=" is missing. This could happen if the flag doesn't exist.[1]

Examine the view. (Go to its editing screen.) Inspect all the flags names you see there (e.g. "bookmarks", "friends"; in the relationships), and make sure you haven't deleted any of them. It's certainly possible to have a view that reference flags that no longer exist ...this would generate the faulty SQL you saw.

-----
[1] But, then, taking $flag->fid would trigger a PHP warning ("Trying to get property of non-object")... it's interesting that you didn't report this. Maybe because the "official" Drupal doesn't alert of these warnings. I suggest you have a look in your watchdog log.

#5

Matt V. - April 16, 2009 - 14:31

I only have one flag field under the relationships section. I tried removing it, but that breaks the view. When I added it back in, I still received the error message in comment #3.

I tried deleting the bookmark flag that I think comes bundled with the flag module, just in case, and I still got the error. I also tried removing the exposed filter I had set up for the flag, and I still got the error.

On the off chance that it might help, I've exported the view and I'm attaching it here.

AttachmentSize
exported_view.txt 9.26 KB

#6

jacobthetopdawg - April 16, 2009 - 17:53

I opened a new tab as suggested, but it appears the flag went through ok with no mysql errors. However, when I try to just click on the flag link in the same window I get the HTTP error 200 message. You mentioned the problem could be a redirection issue. My link is looking like this:

http://192.168.1.100/drupal4/flag/flag/plus_favorite/270?destination=nod...

Could there be a problem in my links?

In FF, the flags work :( .

#7

febbraro - April 21, 2009 - 01:36

For what it is worth, I have seen this issue (the error in views join) when I have a relationship to a flag that does not exist, or exists with a different name. The views relationship looks up flags by name. One way to figure out what is happening is to export the view and look at which flag name it is trying to join and verify that flag exists and is enabled.

Good luck.

#8

mooffie - April 21, 2009 - 02:38

using IE 8 [...]
In FF, the flags work

Perhaps yours is a jQuery issue. Could you upgrade your jQuery and report back? (Use the '-dev' version of jquery_update, because its jquery is newer.)

#9

mooffie - April 21, 2009 - 03:25

@Matt,

  • Perhaps turning on PHP's reporting of warnings could help locate the problem. If you're using the development version of Drupal then it's already turned on. Else, you'll have to turn it on: I couldn't find "official" instructions for doing this; I suggest you search this site for "E_ALL".
  • While its probably true that there's some error in the view, or a bug in our Views integration, I wonder why your left-clicking the link somehow causes Views to run. A question: does clicking a link (and it doesn't matter whether it's left-cliking or otherwise) cause the node to get flagged/unflagged?

#10

cangeceiro - April 27, 2009 - 20:17

I am also getting similiar behavior from my site when I try to add a "Flagged Link" field in a table view. I'm using firefox, and and it throws an error when i click on add. the error is "An error occurred at http://192.168.1.34/admin/build/views/ajax/add-item/requests_marketing/default/field."

If i copy that link into my browser and try to access it, i get a return with no errors. Also, if i refresh the page, it ads the field to my lists of fields. but the field isnt actually displaying anything in the table.

I would lean against this being an issue with a missing flag, as I only have 1.

#11

cangeceiro - April 27, 2009 - 20:27

I found my problem...if its related. This appears to be a bug in views. I was able to fix mine by upgrading to 6.x-2-dev

#12

mooffie - April 28, 2009 - 11:20

Cangeceiro, thank you for the report.

Once somebody corroborates this we should put this info on Flag's homepage.

#13

Matt V. - April 28, 2009 - 15:50

I just tried upgrading to Views 6.x-2-dev and it didn't fix the problem for me. I'm going to try recreating the view from scratch when I get a little more time. I'll report back.

#14

mooffie - April 29, 2009 - 23:12
Status:postponed (maintainer needs more info)» active

#15

pdcarto - May 1, 2009 - 12:38

Not sure if this is related, but when try to put a flag link into a node view where I'm using node id as an argument, the SQL includes a field 'users.nid', which throws a SQL error because users has no nid field.

#16

cangeceiro - May 1, 2009 - 15:49

strangely this problem came back for me. but in a slightly different form. after upgrading to the dev version of views it worked for a day, and just this morning i started getting "Fatal error: Call to a member function get_views_info()" I have opened an issue on the views project at http://drupal.org/node/450690

#17

jacobthetopdawg - May 3, 2009 - 23:50

In response to #8:

Jquery update with -dev version introduced other issues for me. ie broke ajax comments and broke fivestar module. I did notice that flags were going through, but without ajax animations. I'll keep investigating.

#18

mooffie - May 7, 2009 - 04:13
Priority:normal» critical

Marking this 'critical'.

  1. Comment #15 suggests we have a bug in our Views support (flag_handler_field_op::query() is good suspect).

    As for the "HTTP error 200" alert box: It's a mystery because I don't see why any Views code gets called when one just clicks an ajaxy flag link.

  2. It might be that there's an unrelated issue lumped in this report: some IE8 Javascript compatibility issue (see comment #17, which is a reply to comment #8).

#19

mooffie - May 7, 2009 - 05:06

As for the "HTTP error 200" alert box: It's a mystery because I don't see why any Views code gets called when one just clicks an ajaxy flag link.

Hey... perhaps Views erroneously attaches a Javascript click-handler to Flag's links when the view's AJAX support is turned on? I see that Views does .find('ul.pager > li > a, th.views-field a, .views-summary a') so Views is not supposed to pick up our links, but who knows. I can't check things further as I'm not running Drupal.

Could anybody turn off the view's AJAX support and see if it solves the "HTTP error 200" alert box problem?

#20

Matt V. - May 9, 2009 - 05:24

mooffie,

If you mean the "Use AJAX" option under the "Basic settings" section of the view, that was already turned off for the view I've been having trouble with. Just to be thorough, I tried turning off Javascript using the Web Developer Toolbar for Firefox and I still got the error message.

#21

opensanta - May 17, 2009 - 05:42

merlinofchaos said in #450690: Fatal error: Call to a member function get_views_info() mentioned in #16:

Views does not contain the method 'get_views_info()' anywhere, nor try to call it. A grep for the string 'get_views_info' in Views turns up no results. You should look at see what file that call is on and file an issue against the module that provides that file.

Agreed, this is critical:

$ grep -lir "get_views_info" *
flag.incincludes/flag_handler_field_ops.inc
includes/flag_handler_argument_content_id.inc
includes/flag.views.inc
$

#22

ebeyrent - June 4, 2009 - 19:33
Component:Code» Views integration

I also have this issue as described in #16. Any luck on solving it?

#23

ebeyrent - June 5, 2009 - 11:59

Regarding #16, I found that when I had my flag configured to use multiple content types, I got the fatal error. When I removed the second content type, everything worked as expected.

#24

boreg - July 10, 2009 - 13:21

I found solution :)
Its simple. U have to enable that flag u use in views. I mentioned it here: http://drupal.org/node/450690#comment-1796822

#25

quicksketch - September 15, 2009 - 00:47
Status:active» postponed (maintainer needs more info)

I've never been able to reproduce this bug, but the solution posted by boreg in #24 sounds likely to be a fix. Sounds like a problem with flag_friend specifically creating a default view and a default flag that is disabled. Since a new version of Flag Friend has since been released, that might explain why the bug reports slowed or stopped. Unless there is some confirmation that boreg's solution does not fix the problem, I think we can close this issue.

#26

quicksketch - September 28, 2009 - 14:48
Status:postponed (maintainer needs more info)» closed

Closing after lack of response.

#27

Matt V. - November 9, 2009 - 18:12
Status:closed» active

I've updated to the latest version of Views (6.x-1.8) and I'm still getting essentially the same error as in #3. In comment #24 above, is that referring to the "What nodes this flag may be used on" setting for the flag? If so, I have that set.

Can anyone help me pinpoint where the right-hand side of the "flag_content_users.fid =" argument gets set?

#28

quicksketch - November 9, 2009 - 19:34

Matt V: Could you provide steps to reproduce this issue, or post an export that is very, very simplistic? The export you posted above seems complicated to reproduce, needing VotingAPI and custom node types and flags. It'd help to be able to easily reproduce this problem, as it is I'm not sure how to fix something I can't see.

#29

Matt V. - November 11, 2009 - 03:44

quicksketch,

Thanks for the quick response. Here is a simplified example that still exhibits the issue.

AttachmentSize
simplified_view_example.txt 2.87 KB
 
 

Drupal is a registered trademark of Dries Buytaert.