I just installed a new 6.9 site and added the 6.x-1.1 taxonomy_vtn. I was getting PHP errors and resulting database SQL syntax errors when trying to view various vocabularies, which also resulted in no output for the terms even though there were some that should be shown. So searching around drupal.org led to me try something. This seems to have fixed the problems for me, so I submit it as a proposal to update the module.

The file is taxonomy_vtn_overwrites.inc.php.

Here is a diff output with the original file ('<') and my hacked file ('>').

44c44,45
<       $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
---
> //      $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
>       $descendant_tids[] = array_merge(array($tid), array_map('taxonomy_get_term_by_name', $tree));
112c113,114
<       $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
---
> //      $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
>       $descendant_tids[] = array_merge(array($tid), array_map('taxonomy_get_term_by_name', $tree));

Regards,
Bruce

CommentFileSizeAuthor
#3 taxonomy_vtn-6.x-1.1.patch759 bytesAlexisWilke
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AlexisWilke’s picture

Hi Bruce,

This sounds weird... Do you have MySQL? Also you are the only one who mentioned such a problem so far which makes it twice weirder 8-)

The function taxonomy_get_term_by_name() will return an object, when the _taxonomy_get_tid_from_term() returns an integer.

The instructions after that call are using db_placeholders() to create a list of integers that are then used in the SELECT. What you have done may have transformed the 2nd value into 0 and works okay with the SELECT but is not an actual fix.

Would you mind to post the errors if you were to remove your fix? I'd like to see what they are.

Thank you.
Alexis Wilke

sabalaskey’s picture

Alexis,

Yes, I am using MYSQL 5.0.67 on Fedora 10 with Apache 2.2. I didn't check the return value from the programming manual since I just hacked it in real quick from what I inferred. So here are the errors. The number of errors was dependent on how many vocabularies there were.

So the main page displays fine (taxonomy_vtn) but clicking on any vocabulary (in this case taxonomy_vtn/voc/2) gives me things like: (There were two terms in this vocabulary.)

* warning: array_map() [function.array-map]: The first argument, '_taxonomy_get_tid_from_term', should be either NULL or a valid callback in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 112.
* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 112.
* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 115.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /web/html/secure/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /web/html/secure/includes/database.inc on line 241.
* 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 ') AND n.status = 1' at line 1 query: SELECT COUNT(DISTINCT(n.nid)) FROM node n INNER JOIN term_node tn ON n.vid = tn.vid WHERE tn.tid IN () AND n.status = 1 in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 119.
* warning: array_map() [function.array-map]: The first argument, '_taxonomy_get_tid_from_term', should be either NULL or a valid callback in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 112.
* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 112.
* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 115.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /web/html/secure/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /web/html/secure/includes/database.inc on line 241.
* 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 ') AND n.status = 1' at line 1 query: SELECT COUNT(DISTINCT(n.nid)) FROM node n INNER JOIN term_node tn ON n.vid = tn.vid WHERE tn.tid IN () AND n.status = 1 in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 119.

I need to be more precise here. The terms of vocabularies themselves do display. But then clicking on the term (e.g. taxonomy_vtn/term/200) results in no output (except the following errors): This term had one node that should have been displayed.

* warning: array_map() [function.array-map]: The first argument, '_taxonomy_get_tid_from_term', should be either NULL or a valid callback in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 44.
* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 44.
* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 48.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /web/html/secure/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /web/html/secure/includes/database.inc on line 241.
* 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 ') AND n.status = 1 ORDER BY n.title, n.sticky DESC' at line 1 query: SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM node n INNER JOIN term_node tn ON n.vid = tn.vid WHERE tn.tid IN () AND n.status = 1 ORDER BY n.title, n.sticky DESC in /web/html/secure/sites/all/modules/taxonomy_vtn/taxonomy_vtn_overwrites.inc.php on line 79.

Hope that helps.

Regards,
Bruce
(an old C telco programmer who no longer does that for a living and doesn't really know php)

AlexisWilke’s picture

FileSize
759 bytes

Bruce,

It looks like somehow your taxonomy.admin.inc file is not automatically included. It would be interesting to know why that happens.

I'd like you to try a patch that would force the inclusion of taxonomy.admin.inc before the use of the functions that are marked as not found. (You'll need to patch the original, obviously. You can click on the link and look at the code if you'd rather.)

Although this may generate other errors because of another missing file... we'll see!

Thank you.
Alexis Wilke

P.S. I'm a also a programmer in assembly language, C, C++, PHP and some other languages too... 8-) Drupal is "just and off the side project".

sabalaskey’s picture

Alexis,

AHA! Thanks for the input. That patch didn't fix it, but it gave me an idea, along with your earlier comment that I was the only one with the problem. I had the Category module loaded (since that is taxonomy improved), and it has its own wrapper module to interface with taxonomy. Guess which function was not in the Category version of the taxonomy module? The missing function _taxonomy_get_tid_from_term (thanks grep). So all I did was copy that one-liner into the sites/all/modules/category/wrappers/taxonomy/taxonomy.module and it worked. There was an image gallery problem too because of the same missing function. Guess I need to report that to the Category module folks.

So which assembly code did/do you use? I am from the Z80/8086 and Vax780 days. I said that I was old!

Anyway, close this item on taxonomy_vtn.

Regards,
Bruce

AlexisWilke’s picture

Bruce,

Interesting because I was talking with some people who were having some problem with the Brillant Gallery. But I do not think that the problem is the same.

Now I thought that the taxonomy module would always be available... So the taxonomy.module would be there.

It is normal that the Category module did not replicate that function because it is private. Yet we need it when we do an overload and the API is not good enough otherwise...

Anyway, all that to say that the Category folks will probably bark at making such a change.

I did two main ones: 6502 and 68000 (also 68020 and 68030). But I played a bit with a Z80, 6800, MIPS, 88000, 8086, Pentium III, Sparc, PPC... And a bit more I'd had a chance to work on an FPGA. 8-) I never had access to a VAX however.

Thank you for the hint!
Alexis Wilke

AlexisWilke’s picture

Status: Active » Fixed

Marking this as fixed. 8-)
Alexis

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.