Posted by jcfiala on November 8, 2009 at 6:07pm
| Project: | Link |
| Version: | 6.x-2.8 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | jcfiala |
| Status: | closed (fixed) |
Issue Summary
Posted by betz:
I updated link module to 2.8 but i still got a error when bulk updating url aliases.
This is the error:Fatal error: Unsupported operand types in /home/drupalcamp/default_www/sites/all/modules/link/link.module on line 368
I wanted to spin this off to it's own ticket, as the last one was getting a little too history-heavy.
That's an unusual thing to have happen. Are you using the value of the link filed as part of your alias?
Comments
#1
just like to add I commented the line 368 but still there's another problem line 371
Fatal error: Unsupported operand types in /home/dealback/public_html/sites/all/modules/link/link.module on line 371
#2
That's fine, but what I need to know is what is the url path that you entered into pathauto for that node type, and things along those lines. I'd like to reproduce what you're doing so I can then test it here. (And set it up in simpletest as well!)
Thanks.
#3
I had the same problem here, it looks that the "title" settings went missing. Once set, everything went fine again.
#4
I have the EXACT same error when I don't enter a link title beside the link..
Check this out..
http://justinhileman.info/articles/unsupported-operand-types-in-drupal-6x
it didn't work but there might be some useful info..
#5
Well now I can create a any node containing a link field, even with both titles entered, I get the error when I try to view the link.
#6
Receiving the same error for line 368 after updating the module.
Evidently field['attributes'] cannot always be assumed to already be an array.
A quick test like:
if (!is_array($field['attributes'])) {
$field['attributes'] = array();
}
helps things along. Seems like since this is new changes since 2.6 maybe a little refactoring here would be better.
thanks,
Joe
#7
I have the same problem "Fatal error: Unsupported operand types in /home/drupalcamp/default_www/sites/all/modules/link/link.module on line 368" when i type the name of my site without WWW prefix "mysite.com"? when I type with "www" - "www.mysite.com" - all is working fine.
The problem is with 2.8 and 6.x-2.x-dev 2009-Nov-21.
2.6 version is working without the error.
#8
Hey, my web is down duo to this error so get it fixed ASAP, please. Do not postpone it!
#9
Fortunately, downgrade do 2.6 did help. Apparently, 2.8 is a cul de sac of the link module. C'mon guys, hope you can do it better! ;-)
#10
I had the same problem. It didn't seem to matter what values I entered for the link title or URL. The module seems to be sloppily passing around variables. Examining $field['attributes'] shows that it is actually a string.
This patch fixes the problem for me, but the whole module could probably use some tidying up.
#11
Changing status to critical - this seems to be a pretty major blocker. I'd like to see a new release out soon if possible.
#12
#13
Is this patch included in the latest 6.x-2.x-dev build?
#14
@jtsnow Thanks for the patch. I was getting the white screen of death on one my Drupal sites after I upgraded to 2.8. What's odd though is that I upgraded Links on 3 other sites without a problem. Maybe it was because I jumped more version on this site than I did with any other.
#15
The patch applies cleanly to link.module,v 1.24.4.8 2009/11/05 04:09:07 and removed the fatal error for me, which appeared immediately after upgrading from 6.x-2.5 (and occurred both before and after the update.php run). The site is brand new so old trash data is unlikely.
Re: the actual patch contents -
* There is an extra whitespace change in there, easy enough to avoid
* The addition of $field['attributes'] = unserialize($field['attributes']); may be a behavior change. It doesn't appear to be harmful but this might not be the optimal solution.
#16
Pardon my ingornance but what do I need to do to apply that patch?
I am running on a cpanel server with only ftp access to the site, if that makes any difference.
Thanks
-Matt
Followup - I was able to get a copy of the file and the patch on another server with shell access and patched it there. If there's an easier way to do this in the future please let me know.
#17
I just wanted to echo zeropaper's observation: I was getting this error until I noticed that there was no setting for "Link Title" in the content type settings. That is, /admin/content/node-type/(your-content-type)/fields/(your-field-name) had none of the radio buttons selected in the Global settings -> Link Title: section.
#18
I totally understand that people are having trouble with this, but I can't duplicate the error, even using link-6.x-2.8 or the dev version. I'm not feeling good about applying a patch when it's not making any obvious change to me, so I again, need More Data about how to duplicate this problem.
I'm continuing to work on this, because I understand that you're having a problem with it, but I'm hoping someone can give me more data on how this happens. Feel free to export the node type with the link data and post it to the thread.
#19
Hmm... So, going off of #3, it seems that the 'attributes' array doesn't properly get added to the field data when there's a problem with the data in the table - if I go in and remove the 'title' information from the global_settings field in the content_node_field table, then it does indeed cause problems when bulk building the urls, because the field data is screwed up. Editing the field and hitting save - even if I make no changes, fixes the data in the table and causes it to work fine, at least in the dev version.
I continue to investigate.
#20
Alright, so here's what I need from someone to continue working on this:
1) The entire row of data in content_node_field for the field that isn't working - the link field that breaks.
2) And confirmation that you went into the manage fields for your node type, clicked on 'configure', made sure everything was correct, and saved those settings, and that after you did this, you continued to have a broken field.
Thank you.
#21
I had this exact error, white screens etc.. and did as you mention above,
and now everything works again. Not sure why this is necessary, or what got corrupted, but the main thing is that it works now.
Many thanks!
#22
You can probably replicate the situation from details in my comment (#15).
* Install 6.x-2.5 on a fresh test site
* Add some link data
* Update to 6.x-2.8 (or possibly even more recent)
#23
I'll give that a try in the near future, but might not get to it until the weekend.
#24
"went into the manage fields for your node type, clicked on 'configure', made sure everything was correct, and saved those settings"
Worked for me too. Thanks!
#25
I ran into this issue as well... Will be confusing for a lot of users. I propose that the Link Title field should be made required. I have included a patch for link.module.
#26
I've just seen a similar error in a View full of links as well. I was able to track it down to a particular node by restricting it to less and less items and paging through it until I found the offending node. Setting the node's value in the _attribute table to NULL for that entry (the URL was NULL already) fixed the error. I think this is somehow related to a bad deserialization of the attributes that is then not checked to see if it indeed produces an array. The attribute value seemed to be N;
I've seen in other reports of this error that this may be related to some db data problems, but it seems odd since other nodes have N; as a value there and it does not trigger any issues for them.
I wonder if this is related to my issues with missing rel="nofollow" and target="_blank"?
-Daniel
#27
Good news everybody!
I followed the instructions in #22, and that lead me to find the problem. We *had* been writing bad data to the link's attributes, but had fixed that in 6.x-2.8. that said, we still had that junk data in the db, and I discovered that was happening by starting in 2.5, moving up to 2.7, and then going to the latest code.
Would kwinters, and anyone else having the problem where attributes set on the field were not showing in the link, please install the 6.x-2.x dev version tomorrow? This will require a db upgrade, and I strongly suggest backing up your database before doing this upgrade. Back it up!
Once done, please test and let me know if this isn't fixed!
Thank you!
#28
This didn't work for me.
My procedure (a little out of the way but had to find a site that wasn't already fixed):
* Started with a site that had a Link field in a content type, but that content type didn't have any nodes, 2.8 (core is 6.14)
* Changed to 2.5
* Created a node of that type, site broke with the same error
* Changed to devel (CVS checkout of 6.x-2.x branch)
* Ran update.php, which logged the following:
The following queries were executed
link module
Update #6002
* UPDATE {content_type_call_to_action} SET field_cta_link_attributes = NULL WHERE field_cta_link_attributes = '%s'
Note the %s at the end of that, that seems to be the key.
Here's the row in the DB:
mysql> select * from content_type_call_to_action\G
*************************** 1. row ***************************
vid: 60
nid: 60
field_cta_link_url: http://www.google.com/
field_cta_link_title:
field_cta_link_attributes: N;
1 row in set (0.00 sec)
#29
No, kwinters, it's supposed to show %s. That's necessary.
Now, please send me a few rows from your database showing the link data - especially the attributes field. This might be in a content_type_blah table, or a content_field_blah table, depending on if you only have one value per node or multiple.
I came up with this fix by going back to 2.5, moving on to 2.7, and then going to dev, and seeing what happened, and what happened was that junk data was being dumped into the attributes field of the individual link data, which is what I"m trying to clear out here. I really can't go any further on this until I get more data.
#30
There was only one Link entry at the time of the error, posted in #28. The title was intentionally left blank, and for whatever reason the attributes were serialize(NULL).
#31
kwinters: It's been a long thread, and I'm confused about where we are.
With your test, you started with a link 2.8 install, downgraded to 2.5, did something, upgraded to latest, and... now I'm not sure what was wrong after you tortured your setup that way?
#32
My 2.5 setup created the entry in #28 -- field_cta_link_attributes was serialize(NULL) and I guess should be the MySQL null value. The value didn't match the link_update_6002() pattern so it was not modified (the row was the same both before and after the update ran).
However, I still get the error even after doing "update content_type_call_to_action set field_cta_link_attributes = NULL;" manually in the database so I don't think that's even it.
Link.module in the devel branch, right before the error line ($field['attributes'] += _link_default_attributes();) get these var_dump results:
$item['attributes'] - array()
_link_default_attributes() - array(4) { ["title"]=> string(0) "" ["target"]=> string(7) "default" ["class"]=> string(0) "" ["rel"]=> string(0) "" }
$field['attributes'] - string(0) ""
The error happens because $field['attributes'] = empty string is getting combined with an array. The patch in #10 resolves this but it could probably be done better.
#33
Alright, I've adapted the changes in #10 and applied them - I believe the problem is now fixed. Wait for the dev to be available tomorrow, and give it a try.
#34
Tested with latest from CVS, no more error. Thanks!
#35
Automatically closed -- issue fixed for 2 weeks with no activity.