manu wrote:If toc() is called with an invalid/missing "li"-function, toc always returns false i.e. echo toc() shows nothing in template.
Actually, I consider this a bug. I'm surprised that call_user_func('doesNotExist') only gives a warning; apparently, the
manual page doesn't explicitly mention this, even though doesNotExist() would error, as well as $func='doesNotExist';$func(). There's only:
Returns the return value of the callback, or FALSE on error.
Interestingly, call_user_func('trim') returns NULL.
I'm not sure about the fix, however. We might check for is_callable($li) (and report the error manually), or we might simply do $li($start, $ta), what would give a fatal error -- similar to writing tock(...) in the first place.
PS: I have moved this discussion to a separate topic, and put it on the
XH 1.6.6 roadmap.