I've seen the use of recursion in nodequeue_randomizer_weighted_randomize in conjunction with nodequeues of a decent size (i.e. close to 100 items) causing "Maximum function nesting level of '100' reached, aborting!"

IIUC this error will only happen when xdebug is installed as that's what sets the max nesting level, so it shouldn't be a problem as such in production environments, but it has been generating a lot of errors in devel environments for me.

I've refactored the function to remove the use of recursion, and added a shortcut if the list of nodes the function is passed all have the same weight (which may quite often be the case).

Comments

mcdruid’s picture