Been trying to get a call to runSnippet() working through the MODxAPI library, and I think I’ve found a bug but don’t understand why it hasn’t been noticed before. There is a test in the runSnippet() code, just after running the db query, that was:
if(!$this->recordCount($result)==1) {
$row = $this->fetchRow($result);
$snippet = $this->snippetCache[$row['name']] = $row['snippet'];
$properties = $this->snippetCache[$row['name']."Props"] = $row['properties'];
} else {
$snippet = $this->snippetCache[$snippetName] = "return false;";
$properties = '';
}
Seems to me that the conditional is the inverse of what it should be. If the record count is 1, then you want to get the snippet from the database, otherwise you use the ’return false;’ default. Changing the test in this way makes it work for my code too, but I was still a little concerned that I was missing something here. I’m using 0.9.2.1, but I did also check the latest code in svn, and it is still the same.