I recently installed the 7.x-1.0 version of linkit. The module appears to be working ok after brief testing, however when I went to view the recent log report I noticed the following 'notice'.

LOCATION http://foggyperspective.com/admin/linkit/autocomplete/twitt
REFERRER http://foggyperspective.com/admin/linkit/dashboard/wysiwyg_tinymce?leu34q
MESSAGE Notice: Undefined index: show_books in linkit_node_linkit_load_plugins() (line 95 of /home/mosspond/drupal7/sites/all/modules/linkit/plugins/linkit_node/linkit_node.module).

CommentFileSizeAuthor
#16 linkit_node.module.1022940.patch1.15 KBanon

Comments

caschbre’s picture

I'm wondering if this has anything to do with the ajax call to lookup a node when entering an external link (or other text). I was using the linkit button to insert a link to an external site. I started typing 'http://www' and was eventually given a popup error (javascript?).

An AJAX HTTP error occurred.
HTTP Result Code: 404
Debugging information follows.
Path: http://www.foggyperspective.com/admin/linkit/autocomplete
StatusText: Not Found
ResponseText: []

anon’s picture

Thanks for the report, I will take a look at this asap

caschbre’s picture

FYI... I also don't have the book module enabled so maybe there needs to be a check before the function is called?

anon’s picture

Need some more info.

Regarding "Notice: Undefined index:"
Have you updated to Linkit 7.x from Linkit 6.x?

About the "http://www", I dont see what this is happeing, this works grate in D6 but it feels like they have shanged something with the menu URI stuff in D7. (And this should be an other issue I think)

Would be awesome with some help with that thanks.

caschbre’s picture

I installed linkit 7.x on a fresh drupal 7 install so there was no upgrade.

For the "http://" bit, I did a bit more testing. It's very weird. I start type 'http://' and the first letter I type after that I get the popup error. So 'http://w' throws the first error.

If you'd like I can set you up an account on my drupal 7 site that I'm using linkit on. Just use the contact form on drupal to let me know and we can sync up over IM or something.

anon’s picture

Thanks for the feedback.

Do you have any dev site? It would be grate if you could test the "Notice: Undefined index:" with the latest Linkit dev version on that because Linkit 7.x-1.0 release is very odd. Many fixes isnt included in that, I cant see why but unfortunately thats the case.

vitok-dupe’s picture

fresh drupal 7 installation with Linkit 7.x-1.0, error after typing "/", need to shield slash

An AJAX HTTP error occurred.
HTTP Result Code: 404
Debugging information follows.
Path: http://blog/admin/linkit/autocomplete
StatusText: Not Found
ResponseText: 
Object not found!
*/-->
Object not found!
The requested URL was not found on this server.
The link on the
referring
page seems to be wrong or outdated. Please inform the author of
that page
about the error.
If you think this is a server error, please contact
the webmaster.
Error 404
blog
Wed Jan 12 11:57:56 2011
Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/1.0.0c DAV/2 PHP/5.2.17 with Suhosin-Patch
vitok-dupe’s picture

anon:"It would be grate if you could test the "Notice: Undefined index:" with the latest Linkit dev version"

same...

caschbre’s picture

Version: 7.x-1.0 » 7.x-1.x-dev

I installed the latest dev version and am still coming across the same issue after typing in 'http://'.

edit: I changed the version of this issue to 7.x-1.x-dev... if that wasn't appropriate let me know.

anon’s picture

@caschbre: Its ok to change version.

This issue has two issues.

  • Slashes doesnt work with autocomplete
  • Notice: Undefined index: show_books

I submitted a new issue for #1024460: Slashes doesnt work with autocomplete (waiting for D7 update to fix this) so we can keep this this apart.

caschbre’s picture

Sounds good.

For this particular issue... after installing the dev version I was still seeing the "Notice: Undefined index: show_books" log entry.

fietserwin’s picture

As already noted in #3, the fact whether the book module is enabled/disabled triggers these notices as this fact shows/hides the option on the settings form and thus saves/deletes this setting in the settings. So just changing that line of code from:

    // Add Title of the book a node belong to
    if ($settings['display_settings']['show_books'] && $node->bid) {

to:

    // Add Title of the book a node belong to
    if (!empty($settings['display_settings']['show_books']) && $node->bid) {

prevents the notices from appearing.

caschbre’s picture

fietserwin’s picture

No, you are checking a setting from the "administer linkit settings" form. If you enable the book module but do not visit the "administer linkit settings" form again it won't still be available. So just checking if it exists and has a non-empty value (exactly what empty() does) is enough.

caschbre’s picture

That makes sense. So the empty check probably needs to be added to other settings that could technically be disabled. The taxonomy module comes to mind here.

anon’s picture

Status: Active » Needs review
StatusFileSize
new1.15 KB

Thanks for the suggerstion fietserwin but this patch has a diffrent solution.

I have this function called _linkit_node_get_default_settings that will set all necessary variables into the settings array just to get rid of all this Undefined notices.

Please test this, and tell me what you think. Thanks.

caschbre’s picture

That patch does not appear to have worked.

Also... I'm seeing the notice message eight times for each letter. Is the code cycling through that many times to throw the notice eight times?

anon’s picture

Status: Needs review » Needs work

$settings['display_settings']['show_books'] is used in two line of code.
43 and 94 (latest dev)

Its used once for each result you get from the node plugin.

Let say you give an "D" and get 8 results, this error should be report 9 errors.
1 for the settings where we build the SQL query, and 8 times for results (1 for each result row)

But I will look at this, to make sure its not cycling through too many times.

Regarding my patch, that should work, cant see why it woulnd. Its append all "missing" variables to $settings['display_settings']
Any idéas why this not work?

fietserwin’s picture

Patch works for me and looking at the code it indeed should work. Stepping through with a debugger I can now see the 'show_books' element being added to the settings. And this solution looks more fool proof to me than my quick patch.

@cashbre: your remark about taxonomy module is right: same type of patch should be applied to function _linkit_taxonomy_get_default_settings(&$settings)

anon’s picture

Status: Needs work » Needs review

@fietserwin: Thanks for testing.
Do we need to change _linkit_taxonomy_get_default_settings(&$settings)?

If no settings exists in the variable DB table (variable name = linkit_term), that function should applie the missing values in the settings array. Does that fail right now?

caschbre’s picture

The patch in #16 does work. My manual patching abilities failed me as I cut one too many lines. :-)

This looks good.

anon’s picture

Status: Needs review » Reviewed & tested by the community

Grate, Thanks all for testing.
I will commit this when I get home today.

anon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for reporting, reviewing, and testing!
Committed to DRUPAL-7--1 branch.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

fietserwin’s picture

#20: I'm not sure as it is indeed only 1 setting. I did no test taxonomy, I just saw the same pattern applied there. The pattern being: trying to merge an array recursively (while neither += nor array_merge are recursive). So perhaps better to use the same working pattern at all places, as the moment you add a 2nd setting, this error might be reintroduced on that spot.

anon’s picture

ah I see, Ok I will do that.

Status: Fixed » Closed (fixed)

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