There are a number of sql statements that have code like (or similiar) to

WHERE n.type IN (".str_pad('', count(variable_get('casetracker_project_node_types', array('casetracker_project')))* 5 - 1, "'%s',").")"), variable_get('casetracker_project_node_types',array('casetracker_project')));

which generates a when statement like WHERE n.type IN ('casetracker_project','0','0') with one '0' per type installed on Drupal. Problem is this does not always work. I am running under Windows XP with mySQL 4.1.7 and the resulting query returns no rows. Simplifing the query to WHERE n.type IN ('casetracker_project') works.

This can be achieved by filtering the value of variable_get('casetracker_project_node_types', array('casetracker_project')) using array_filter which removes all the unset (zero) array elements. So using the example statement that would become something like

$project_types = array_filter(variable_get('casetracker_project_node_types', array('casetracker_project')));
WHERE n.type IN (".str_pad('', count($project_types)* 5 - 1, "'%s',").")"),  $project_types);

Comments

morbus iff’s picture

Yes, that's actually on the todo list - if you check over the code in HEAD, you should see a few uses of array_filter already - I just haven't gotten around to replacing all the others. It'll happen eventually.

morbus iff’s picture

Status: Active » Fixed

This has been committed. Could you do a strong runthrough (with potentially the devel.module's SQL queries enabled) and make sure everything is working right? The first draft of the patch had missed a few areas, which caused the "My Projects" part to fail. Strong testing of some of the sample URLs in the README.txt would be appreciated.

Anonymous’s picture

Status: Fixed » Closed (fixed)