After creating a new content type and adding a new image folder "AudioBook" under sites/default/files, we started to get a lot of weird error messages and warnings.
Example:
INSERT INTO search_node_links (caption, sid, type, nid) VALUES ('70711553299980jpg', 844, 'node', 7071155329998) in /drupal/modules/search/search.module on line 607.
Looking at the table, sorting by "nid" DESC, I see records like these:
sid type nid caption
924 node 4294967295 97882421120880jpg
923 node 4294967295 97882421151400jpg
922 node 4294967295 97882421141290jpg
921 node 4294967295 97882421164680jpg
920 node 4294967295 97882421116610jpg
904 node 4294967295 9788281787384jpg
902 node 4294967295 9788281787414jpg
973 node 4294967295 9788242107466jpg
874 node 4294967295 97882817872300jpg
866 node 4294967295 97882817871480jpg
864 node 4294967295 97882817871000jpg
881 node 4294967295 97882817872850jpg
852 node 4294967295 97882817870490jpg
857 node 4294967295 97882817870010jpg
Look at the value in the field nid. Since the max nid value at the site currently is at only 1200ish, this is very wrong. And from the previous error message, we see that the value inserted for "nid", is not a nid at all, but an EAN number.
The problem arises from both the search_index function being an absolute mess, and secondly from this preg_match:
if (preg_match('!(?:node|book)/(?:view/)?([0-9]+)!i', $path, $match)) {
$linknid = $match[1];
This will pick up anything looking like AudioBook/, BoOk/, asdfasdfsadfsadfsadfbook/ and use it as a valid nid.
I've got no idea what the purpose of this code is supposed to do, but it is generating a HUGE amount of warnings/errors and the search_node_links is a total mess.
PS.
What is the caption field in the search_node_links for? Just to store the node title x-times over?
Comments
Comment #1
erlendstromsvik commentedHow do I edit my issue?!
This line:
AudioBook/, BoOk/, asdfasdfsadfsadfsadfbook/
should read:
AudioBook/(number), BoOk/(number), asdfasdfsadfsadfsadfbook/(number)
Like this:
AudioBook/21353215235, BoOk/123432151235, asdfasdfsadfsadfsadfbook/1234321352315
At least the preg_match and accompanying line, should read something like this:
Comment #2
jhodgdonWow, this looks like something we should definitely fix! Probably fix in Drupal 7, and then backport to Drupal 6?
Comment #3
jhodgdonI'm not sure it is really a "critical" issue, although I think it should be fixed.