This is probably quite unlikely to happen, but it happened for us: We used the Module, customer decided to not use TAC any more, disabled the module and then we had a "function not found" on every node edit with a taxonomy reference field.

The Problem is, that TAC adds a new callback in taxonomy_access_field_info_alter() but never removes it again when the module is disabled.

Now the taxonomy_options_list function in drupal core does not check if the defined functions does exist and fails.

I already wrote a core patch #1358094: Function taxonomy_options_list() should check if function exists , but maybe you want also to take care about this problem?

Basically the best would be to remove the callback setting when disabling?

Comments

xjm’s picture

Status: Needs work » Active

Yeah, this is a known issue. #1281732: Fatal error when taxonomy_options_list() tries to call an undefined callback function is the core issue, but we probably need to provide a workaround.

xjm’s picture

Title: Disabling of Module could cause a "function not found" on Nodes with Taxonomy Reference » Clean up options list callback on module disable
schnitzel’s picture

StatusFileSize
new1020 bytes

here a patch which sets all callbacks empty during disabling the module (deinstalling would be too late)

schnitzel’s picture

StatusFileSize
new944 bytes

sorry here a better one, without ugly debugging ;)

schnitzel’s picture

Status: Active » Needs review
schnitzel’s picture

StatusFileSize
new944 bytes

wrong patch, ignore

schnitzel’s picture

StatusFileSize
new2.99 KB

and here the patch with tests included. BTW: found out that I made a == instead of a = in the above patches during writing the tests ;) but at least I know now that the tests work!

tim.plunkett’s picture

Cleaned up the docs a bit. Uploading both the test and fix, and just the test.

Awesome patch @Schnitzel!

Status: Needs review » Needs work

The last submitted patch, taxonomy_access-1358106-8-test_only.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new2.98 KB
new2.11 KB

Whoops, my bad.

xjm’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

pwolanin’s picture

Status: Closed (fixed) » Active

enable and disable the module and get:

Notice: Undefined index: options_list_callback in taxonomy_access_disable() (line 1741 of modules/taxonomy_access/taxonomy_access.module).
pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new718 bytes
xjm’s picture

Status: Fixed » Closed (fixed)

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