The taxonomy_vocabulary_load() function returns NULL on non-existing vocabularies, where it should return FALSE.

As a consequence, pretty errors are displayed when calling /admin/content/taxonomy/xxx on a non existing vocabulary.

Comments

damien tournoud’s picture

Title: taxonomy_vocabulary loader should return FALSE on non-existing vocabularies » DROP task - all menu loaders should return FALSE on object not found
Component: taxonomy.module » menu system

Registered this as DROP task #107, maybe other menu loaders don't properly return FALSE.

dawehner’s picture

StatusFileSize
new492 bytes

here is the patch
for this small issue // i will look for more things like this tomorrow morning

pwolanin’s picture

Status: Active » Needs work

use FALSE

lilou’s picture

StatusFileSize
new488 bytes
lilou’s picture

StatusFileSize
new938 bytes

+doxygen

damien tournoud’s picture

Looks great, thank you.

Can we check that all other _load() functions correctly return FALSE?

lilou’s picture

I check all _load() function and I haven't find NULL return.

damien tournoud’s picture

Status: Needs work » Reviewed & tested by the community

Ok, so this looks ready to go in.

damien tournoud’s picture

By the way, thanks lilou.

dries’s picture

Is checking the return value of _load() functions something we can write a test for?

damien tournoud’s picture

@Dries: we need to think a bit about that.

With static code analysis, it would be easy to cover all cases. On our testing framework, we could just call each _load function with a dummy value (NULL, for example) and verify that FALSE is returned. That's not perfect but it can provide a safety net for future regressions. I'll check if that's possible / easy to do.

dries’s picture

Version: 7.x-dev » 6.x-dev

I've committed this to CVS HEAD. Should probably be back-ported to DRUPAL-6.

pwolanin’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

still need to go to D6

pwolanin’s picture

Status: Patch (to be ported) » Reviewed & tested by the community
StatusFileSize
new1.03 KB

Patch needed to be re-rolled from the drupal root dir, but applies and works.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Looks good, thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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