I have path auto and taxonomy_access both set up on a clean drupal 4.7 installation.
I've enabled the generation of index aliases, and set the pattern for page's to "[catpath]/[title]".
I have a vocabulary "Sections" with the term "information" in it and I've created a story with the information term assigned to i.
When I attempt to access one of the aliases, 'information/welcome' and 'sections/information' take me to the page I expect, but when I try going to 'information/' or 'information' I get the following error:
* warning: preg_replace() [function.preg-replace]: Unknown modifier '\' in /var/www/beta/drupal-4.7.0/includes/database.inc on line 284.
* user warning: Query was empty query: in /var/www/beta/drupal-4.7.0/includes/database.mysql.inc on line 120.
* 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 'LIMIT 0, 10' at line 1 query: LIMIT 0, 10 in /var/www/beta/drupal-4.7.0/includes/database.mysql.inc on line 120.
If I disable taxonomy_access, the alias start working again. At first glance, it seemed like the problem was in taxonomy_access, but after a few hours of debugging I noticed that the same error appears if I use node_privacy_byrole.
The closest I can track it down is that when an access control module is on, node.module forces the distinct check in db_rewrite_sql() which is called by node_pathauto_page(). The regex fails the resulting SQL is invalid, causing the whole enchilada to fail. The regex seems to fail because it doesn't like the trailing "/" on $prefix ( set to "information/" in this case), but if I strip it off the SQL that's generated still doesn't execute properly.
I'm not really familiar with drupal works at a low level, so this is just my best guess from tracing bits of the code.
Comments
Comment #1
creatorsdream commentedThis also happens with latest release of drupal 4.7 cvs and pathauto cvs. And I am not even using taxonomy_access or taxonomy_access. So, I guess I'll just have to turn off "Create index aliases" for the time being.
Comment #2
ggilbert commentedWell, I sat down again tonight to see if I could sort out a solution, since apparantly the module is without a full time maintainer.
The best I can tell, the prefix parameter to db_rewrite_sql() is supposed to be the name of the table that has the primary key in it. Right now the name of the page is being passed in, so even if it wasn't ending with a '/' the node alias would appear to be the wrong thing. Just dropping the $prefix from the db_rewrite_sql() seems to work. It used the default value of 'n' which maps to the node table.
It appears to be functioning now, but I really can't tell if I'm subtly breaking some kind of functionality. It's an easy change to make, but I don't want to post a patch for something that might be a very broken workaround.
Comment #3
creatorsdream commentedI looked for "db_rewrite_sql()" and could not find it. Could you give a little more info on how you made the change?
Comment #4
darren ohThis error with index pages also occurs when organic groups access control is enabled. I have reported it to the organic groups project in issue 68544.
Comment #5
gregglesI think the problem was fixed as a result of the security problem back in August.
But I really wanted to alert you that I plan to remove the index alias function which definitely removes this problem.
If that seems like a bad idea, now is a good time to speak up!
http://drupal.org/node/91105