using the current 6.x.5.1, enabling the module I got 4 times this message:

Warning: Call-time pass-by-reference has been deprecated in .............taxonomy_treemenu.module on line 1649
Warning: Call-time pass-by-reference has been deprecated in .............taxonomy_treemenu.module on line 1660
Warning: Call-time pass-by-reference has been deprecated in .............taxonomy_treemenu.module on line 1717
Warning: Call-time pass-by-reference has been deprecated in .............taxonomy_treemenu.module on line 2614

?

Comments

adamo’s picture

Same here.

From the PHP docs (http://us2.php.net/manual/en/language.references.pass.php):

Note: There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);.

Remove the extra '&' from the variables being passed in the function calls on the lines indicated by the PHP warnings, and everything will be OK.

Example:

Line 2614 before:

$tid = _taxonomy_treemenu_tree_append_node_links(&$item, $ttm, $np, $nr);

Line 2614 after:

$tid = _taxonomy_treemenu_tree_append_node_links($item, $ttm, $np, $nr);
adamo’s picture

Also an issue on line 900 of taxonomy_treemenu.admin.inc:

    self::opts(&$f, $gid, $group);

Should be:

    self::opts($f, $gid, $group);

edit: Btw... Thanks a ton for this module. It does exactly what I needed.

rcrowther’s picture

Hello - just done! Adamo - I'll be onto yours in a minute..

That's right for those lines, but if you want the coding background -

I use Debain/Ubuntu packages, so I get ever so pro, ever so conservative, 'soft' setup. So I never see this bug! It just works. I have to spot it or find it, and there's nearly 2000 lines of brand new code here, no to mention the inherited stuff. And it's the second time this has hit me. Anyone got suggestions?

Second, three of the reported lines are not a Treemenu problem at all. They seem to be the same thing, but subtly, they are not. They are a piece of, what shall we call it?, PHP unanticipated functionality..

Cheers for the thumbs up admao. Right now, I have an ear wide open for the kind of functionality people need. And I think the module now has a sound base to develop on. So e.g. V3 had fully back tracking breadcrumbs, there is work to do on views, we could integrate Pathauto into extended URLs - maybe I should post my list?

adamo’s picture

I get it. Still, call time pass by reference is deprecated, and some day will not be available at all. Also, the manual entry for array_walk() shows that the $user_data array is not passed by reference. So I think passing $user_data by reference is technically incorrect usage of the array_walk() function, even though it may work fine (for now) with call time pass by reference enabled in php.ini.

There is a workaround that won't break when call time pass by reference is disabled (or removed from php completely). Instead of passing the $user_data array by reference, you pass by value an array containing a reference to your $user_data array. There's an example here: http://www.nakedtechnologist.com/?p=115 Take a look at the section titled "Embed the object reference within a passed-by-value array".

I've just started using this module so I don't have any feature requests yet. :) I do need to figure out how I'm going to handle breadcrumbs in my implementation but I think the Custom Breadcrumbs module will take care of that. I'm currently using an modified version of the default taxonomy_term View, which is working fine for me. I'm a big fan of Pathauto and use it for everything but currently I'm not using the extended URLs. It would definitely be a good feature to have though.

rcrowther’s picture

Oh, call time pass by reference is removed for certain wherever I find it!

What has happened, I think - much of this was written clean, I cut and pasted the function definitions, overlooked the reference, then never got alerted. Maybe I should mess with my PHP ini, but then I create my own upgrade instability....

I've patched using the workround you mention. Somewhere I saw a comment that while the PHP folks think array_walk() with reference parameters would be useful (well, clearly, here), they're worried about backward compatibility, so they changed the manual instead! I like the workround though, it's clearly a bodge, but I'd say its structurally ok (should be future proof), so in it goes. Surely you would want to use the array handler functions where possible - cleaner code, and maybe a speed advantage too.

I'm wondering - I think lots of users will be very happy with stock URLs. Still, there is a killer possibility in the works (most of the grunt code is there already). A different version of the extended URL would pass back not the menu name, but the menu link id (mlid) itself. Disadvantage: you need an alias for EVERY SINGLE LINK, if you want aliases. Ow! Advantage: Oh, its great. Hyper efficient breadcrumbing with a few lines of code (no recursive searches). Menus on a page can have backtracking breadcrumbs INTO THE MENU ITSELF. Build expanding menus WITHOUT javascript. Oh yeah.

Anyhow, cheers for the notes - it takes time to write posts, but right now, this goes straight back to the module.

adamo’s picture

Cool. :) My needs for this module are very basic. I needed some menus generated from a few specific taxonomy terms and their children. Of all the taxonomy-menu type modules, this is the only one I could find that would do that.

rcrowther’s picture

Great. That's why I implemented V5 like this. Now, if anyone else has those needs please post!

rcrowther’s picture

Status: Active » Fixed

All gone now, I believe?

Status: Fixed » Closed (fixed)

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

b3liev3’s picture

Subscribing #1