Closed (fixed)
Project:
Path redirect
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Dec 2009 at 06:46 UTC
Updated:
20 Aug 2010 at 14:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jackalope commentedI'm having the same exact problem, but mine didn't start until I updated to 6.x-1.0-beta6.
Comment #2
Sborsody commentedI just got this problem on beta5. I'm trying to edit a previously created redirect so that it points to the actual node instead of the path alias. But there is a mistake in the SQL somehow. The path in the redirect that I'm editing should be 'wpl/' not 'wpl'. The old site has links to 'wpl', 'wpl/', and 'wpl/index.html' that I need to all redirect to 'node/241' on the new site. That's the reason for the duplicate entry.
Comment #3
dave reidDelete the undesired redirect (for 'wpl/') first then. If you create a redirect for 'wpl' it will also work for 'wpl/' so you don't need to create another one.
Comment #4
peterx commented#3 is a reply to #2 and and #2 is nothing to do with this issue.
Comment #5
dave reidOh, sorry about that. I think I actually might have fixed this in recent CVS commit. Please test out the 6.x-1.x-dev and see if you still get the error (make sure to check for the erroneous redirects first and remove them).
Comment #6
dave reidComment #7
Torenn commentedYes i confirm it started from beta6 as well, and no, latest dev release doesn't fix it.
Comment #8
hedinfoto commentedWe are having the same issue
user warning: Duplicate entry 'node-' for key 'source_language' query: INSERT INTO us_path_redirect (source, redirect, query, fragment, language, type, last_used) VALUES ('node', 'about/news-events/blog/Php-errors-rule', '', '', '', 301, 1261443460) in C:\MyDocs\websites\multi-giant-sites\includes\common.inc on line 3467.version 6 beta 1.
Comment #9
hedinfoto commentedJust tried the dev version and got
user warning: Duplicate entry 'node-' for key 'source_language' query: INSERT INTO us_path_redirect (source, redirect, query, fragment, language, type, last_used) VALUES ('node', 'about/news-events/blog/phperrors', '', '', '', 301, 1261452606) in C:\MyDocs\websites\multi-giant-sites\includes\common.inc on line 3467.Comment #10
ceefour commentedI'm also having this problem every time I create a new content.
It seems that the 'source' needs to be the actual node path (like 'node/123') instead of simply 'node' (which usually goes to root/front page) ?
Comment #11
Cynthia Ewer commentedsubscribing - also experiencing this issue
Comment #12
arcticweb commentedSame problem here.
Comment #13
Sborsody commentedHow are you creating the new content with the redirect? The node has to exist before you can create a redirect for it.
Comment #14
MadOverlord commentedI just got this. It happened when I created a node and specifically gave it a name that conflicted with the name of a page generated by a view (because I wanted to override the display of one particular page).
I changed the name of the new page to another value (also in the view's namespace but not matching a valid view) -- no error reported -- and then changed it back (so it again conflicted), and again, no error.
However, a quick check shows this happens on any node create whether it conflicts with a view or not. I just created a dummy page derf/derf and got the error. I don't think I've created any new page nodes on the site in a month or so.
I am running Path redirect 6.x-1.0-beta6 and Pathauto 6.x-2.x-dev (2009-Dec-05)
Comment #15
Cynthia Ewer commentedI am seeing these errors with a fresh install, clean database, D 6.15, version 6.x-1.0-beta6. I am not using pathauto.
The error occurs on content creation of all node types.
Comment #16
Sborsody commentedThis sounds confusing because I'm under the impression that URL redirects are not normally created automatically. The only setting associated with automatic creation is when a url alias is updated (using pathauto). Mind you, I'm not familiar with the inner workings of this module.
Comment #17
dperdue commentedI'm running beta5 (because of incompatibilities with Pathauto), not beta6, but I'm also having the problem.
It appears that when you have "Automatically create redirects when URL aliases are changed" checked on the settings page and you create a new node and edit the path alias for that node before the first save, this module creates a redirect from "node" to whatever you entered as the URL alias. It continues to do this with other nodes you create, thus the error message. It only occurs for me on nodes that don't have a Pathauto rule defined.
Comment #18
dave reidCommitted a change to CVS that should fix this bug. Please try the latest code and report back if it fixes this condition.
Comment #19
Christoph Haas commentedI just checked out the revision 1.3.2.7.2.96 of the path_redirect.module file and put it into my modules/path_redirect directory. All other files are from the 6.x-1.0-beta6 version.
Creating the node works without any errors now. But clicking on "Edit" fails with this error message:
Fatal error: Unsupported operand types in XXXXXXXXXXX/sites/all/modules/path_redirect/path_redirect.module on line 395
Comment #20
dave reid@Christoph Haas: That's because you mixed files from two different versions. You'd need to switch all the files to that changeset/revision.
Comment #22
jenlamptonI am getting the same error - but for taxonomy. I'm running the dev version from 2010-Jan-09.
The error appears the FIRST time I try to re-order terms on the "list terms" page for a vocabulary. The second time I reorder those SAME terms, the error does not appear. If I re-order different terms, I get the error again.
This save triggers hook_taxonomy for each term that is moved in the re-order. And even though all my terms already have redirects, an "INSERT INTO" is triggered, throwing this error.
The issue here is that pathauto does not differentiate between $op = insert and $op = update and in both cases calls
path_redirect_save($redirect). The function path_redirect_save tests $redirect['rid'] to determine weather to update or insert, but when this function is called by pathauto the rid is always NULL, so it always tries to insert instead of updating.
I've added a few lines to retrieve the existing rid before saving the redirect, and the error has disappeared for my use-case and paths are being updated appropriately. It would be interesting to see if this solves the problem for nodes, too.
Patch attached.
Comment #23
Tom Ash commentedI get a similar error:
user warning: Duplicate entry 'node-' for key 'source_language' query: INSERT INTO path_redirect (source, redirect, query, fragment, language, type, last_used) VALUES ('node', 'pfblog/green-jobs-for-british-workers', '', '', '', 301, 1266698978) in /home/sant0317/public_html/includes/common.inc on line 3467.I've tried disabling pathauto as I know there may be incompatibilities with the present version and the problem persists (the above message came on saving a new node after having disabled pathauto.)
(This is using 6.x-1.0-beta6 rather than 6.x-1.x-dev which I see this issue is classed under.)
Comment #24
Tom Ash commentedThinking about it - might this be a Global Redirect issue? It's Global Redirect which automatically created the path redirect which threw the warning above.
Comment #25
Tom Ash commentedPeculiarly, this issue seems *not* to arise when aliases are created by Pathauto (though I wouldn't swear to this - am happy to test it out more if the module developers would like me to, I'm currently just waiting to see what they say...)
Comment #26
jenlampton@Thomas Ash - have you tried the patch above for path_redirect? I am curious to see if it solves your problem. In my case it was pathauto that was calling a function in path_redirect. If Global Redirect was calling that same function (which I have updated) then perhaps the patch in #22 will solve your problem too.
Curious,
Jen
Comment #27
jhedstromThe patch in #22 worked for me.
Comment #28
emsearcy commentedMy thought about the patch from #22 is that while it would prevent duplicates, I really don't want a redirect from "node" anyhow (#22's patch would allow the first one but not successive ones). In fact, Path Redirect won't even let me create a redirect from "node" in the interface, so I think it would be wise to prevent it from doing so on the backend.
My setup may be overly complicated to know what is influencing what (pathauto, path_redirect, global redirect), but I do know that path_redirect_check_alias_changed() is being called on new nodes with the arg $path="node/". I don't think there should ever be a valid reason to create this redirect (which gets sanitized to just "node" by path_redirect_save()), so I'm just checking for that case.
Note also that this patch correctly declares $base_path to be global so that it looks in the right scope for this (otherwise it will always be ""), and I also added a return FALSE to handle the latter case where where we don't create a redirect (to match the documentation at the top of the function).
Or maybe a better place to put this would be a check for "node" in path_redirect_save() after sanitizing happens?
(Patch is against 6.x-1.0-beta6)
Comment #29
jenlampton@emsearcy I think the problem with redirects being created for 'node' was resolved in the latest -dev version. Have you tried that one?
If the 'node' redirect problem is resolved, then I think the patch in #22 should solve the duplicate entry error, and things should be peachy :-)
Jen
Comment #30
JGO commentedI just updated to beta 6 and have this error, what is the proper solution?
Comment #31
jenlampton@JGO use the dev branch.
Comment #32
agileware commentedIf you run the current dev version (2010-Mar-02) there is no issue, you don't need to patch it.
Does this issue still need to be open?
Comment #33
JGO commentedIt seems indeed that the dev solved it.
Comment #34
Tom Ash commentedI update to dev based on the above comments and got the following error, any help in dealing with which would be much appreciated:
http://drupal.org/node/737778
Comment #35
sunward commentedI obtain the same error when creating a new page. This seemed to happen when I tried to save a page twice (the first save didn't seem to work). I did delete a page, and the error didn't occur on the next new page. It did return again after wards.
Comment #36
francisconi.org commentedsubscribing - also experiencing this issue
Path redirect 6.x-1.0-beta6
Comment #37
mobilemichael commentedsubscribing
Comment #38
kgthompson commentedsubscribing
Comment #39
bluesomewhere commentedSubscribing.
user warning: Duplicate entry 'node-' for key 2 query: INSERT INTO path_redirect (source, redirect, query, fragment, language, type, last_used) VALUES ('node', 'jello-world', '', '', '', 301, 1274077369) in /path/to/drupal/includes/common.inc on line 3477.Global Redirect 6.x-1.2
Path redirect 6.x-1.0-beta6
Pathauto 6.x-1.3
Comment #40
JGO commentedYep Joshua R. Simmons something is not very allrighty with all these modules together
Comment #41
willhowlett commentedsubscribing
Comment #42
WhenInRome commentedSame errors--
Duplicate entry 'node-' for key 2 query: INSERT INTO path_redirect (source, redirect, query, fragment, language, type, last_used) VALUES ('node', 'Improve-your-gasmilage-for-the-Enviroment', '', '', '', 301, 1274647451) in /var/www/pressflow6/includes/common.inc on line 3470.
Comment #43
elally commentedSubscribing
Comment #44
sergmain commentedsubscribing
Path redirect 6.x-1.0-beta6
Organic groups 6.x-2.1
Node Reference 6.x-2.x-dev
Comment #45
kettari commentedChances there will be fixing release?
Comment #46
TallDavid commentedsubscribing Note to self: aft.c
Drupal 6.17
Path redirect: "6.x-1.0-beta6"
Pathauto: "6.x-1.x-dev"
Global redirect: "6.x-1.2"
Will try the latest .dev version of Path Redirect.
Comment #47
dflitner commentedSubscribing...
We get this same error message.
Creating a new page with a path in URL path settings will give the error. Creating a new page with no path gives no error. We can then go in and edit the page and add a URL path and it still gives no error.
Not using the URL Redirect option for these pages at all.
Currently:
Drupal 6.16
Path redirect 6.x-1.0-beta6
user warning: Duplicate entry 'node-' for key 2 query: INSERT INTO j9we_path_redirect (source, redirect, query, fragment, language, type, last_used) VALUES ('node', 'access/lending-faq', '', '', '', 301, 1277315325) in path-to-drupal/includes/common.inc on line 3477When we can upgrade, I'll install the dev version of Path redirect and report back on the outcome.
Comment #48
Anonymous (not verified) commentedsubscribing
Comment #49
iamba commentedsubscribing, same issue
user warning: Duplicate entry 'node-' for key 2 query: INSERT INTO dr_path_redirect (source, redirect, query, fragment, language, type, last_used) VALUES ('node', 'xxxxxxxxx', '', '', '', 301, 1277431345) in /home/xxxxxxxxx/public_test/includes/common.inc on line 3477.
using
Drupal 6.17
Path redirect 6.x-1.0-beta6
not using Pathauto or Global redirect
Not sure why I have a "dr_" prefix in front of "path_redirect"
Comment #50
Bronwyn McL commentedSubscribing.
Comment #51
kubala.webdesign commentedDo you get that error when you create new node and set path alias , or when you editing existing one?
If when you create - i think 'path redirect' don't get nid of node and try create redirect from node/ to alias.
Try disable "Automatically create redirects when URL aliases are changed." in admin/build/path-redirect/settings, and write action (and append to a trigger after node insert or sthg like that) which add record to path_redirect table AFTER save node (use $context['node']->nid to get node ID).
I have the same problem to solve, but i'm started work 5 minutes ago, I didn't read module source yet, so if my idea have no sense - please forgive me ;)
Sorry for broken english.
Greetengs from Cracov, Poland.
M. Kubala
Comment #52
kubala.webdesign commentedmy solution for 6.x-1.0-beta6 in attachment.
This is possible to get a nid for new nodes, just add 'insert' statement in hook_nodeapi(..) and modify path_redirect_check_alias_changed(..), but when my version of module added redirect from node/XXX to alias/of/node, I've got information about infinity loops (from path_redirect_goto, I don't understand why url($redirect['redirect']) == url($_GET['q'])).
Comment #53
emilyf commentedsubscribe
Comment #54
emilyf commentedChanges in #52 appear to work for me.
Comment #55
kubala.webdesign commented#846714: Redirect from old path to node/XXX after alias having been removed #6 - another patch - better prevention for duplicates and some additional fixes.
Detailed info in comment.
Comment #56
jhedstromFix in #52 works for me as well.
Comment #57
dave reidThis is already fixed in the latest dev, so marking as fixed.
EDIT: Sorry meant to say 'dev' instead of 'beta'.