PHP errors when no taxonomy term is selected.
MedicSean37 - September 20, 2008 - 06:01
| Project: | Simplenews Digest |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
I get the following errors in my logs and no newsletters go out.
array_fill() [<a href='function.array-fill'>function.array-fill</a>]: Number of elements must be positive in /home/dickson/www/www/modules/simplenews_digest/simplenews_digest.module on line 344.
implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in /home/dickson/www/www/modules/simplenews_digest/simplenews_digest.module on line 344.
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 ') AND n.type IN ('article','event','interview','site_news') AND n.created >= 0 A' at line 1 query: SELECT DISTINCT n.nid, n.type, n.title from node n INNER JOIN term_node t ON n.nid = t.nid WHERE t.tid IN () AND n.type IN ('article','event','interview','site_news') AND n.created >= 0 AND n.created < 1297451227 AND n.status = 1 ORDER BY n.created DESC in /home/dickson/www/www/includes/database.mysql.inc on line 172.So I went to line 344. It looked like it was creating a string from an array of selected terms. Well I don't have any terms selected, b/c I want all nodes of the content type to be included regardless of the tax. term. So I uncommented some of your debug code in the menu_hook function, and selected a few terms. after running myurl/test, There are no errors in the logs, however no emails/newsletters went out either, nor did a newsletter content type get created.

#1
Well, I was able to test it with the selected terms, and it works fine. Those errors come with no selected terms. I can easily reproduce the error. Anyways, it would be nice not to need any of the terms selected.
#2
Thanks for the report. The taxonomy selection feature is one that I will be improving soon.
#3
Hi,
Love the functionality of your module. Just hated the taxonomy term dependency. My site is actively filled with new nodes, but most in new terms. The zipped module (sorry, I suck and patching) just ignores taxonomy when no terms are selected. Basically none => all.
Hope it helps! (now just need to find out how to digest a view ;-) )
Mark
#4
Sorry, previous file has some mistakes.
#5
Hey, just ran into this problem and it is a bug IMHO, not a feature request.
#6
IMHO, if something is still in a todo-list, it's a feature request. If something is written in the code but it doesn't work or works wrong, it's a bug.
Anyway, some patches attached.
Module file patch is just to take out the taxonomy from the query.
The info file patch is fixes the placement of the module (under mail) and adds the dependency to simplenews.
Thanks for the module!
Mark
#7
#8
Thanks.
I've looked the code over. It's basically the same code I've committed to the d6 dev branch. If someone can just confirm it's working no a live d5 site without problems, I'll commit it to the d5 branch.