Here is what I experienced:

1. Called node_type_delete('my_content_type') from hook_uninstall()
2. node_type_delete() deleted from {node_type}
3. node_type_delete() called node_get_types(), which had not yet been initialized
4. node_type_delete() called module_invoke('node_type', 'delete', $info) with an empty variable
5. content_type_delete() failed

As-is, it works when deleting content types from the administrative page. We didn't notice this problem until now because node_menu() calls node_get_types() for the administrative pages, which initializes a static variable before node_type_delete() deletes from {node_types}.

The attached patch swaps two lines, calling node_get_types() before deleting from {node_type} in every case.

I experienced this with Drupal 5.x, but I see the same thing in Drupal 6.x so I am marking this for 6.x-dev.

CommentFileSizeAuthor
node_type_delete_3.patch486 bytesnjivy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dmitrig01’s picture

+1. Great. I would mark it as RTBC if more people reviewed it.

hunmonk’s picture

Status: Needs review » Reviewed & tested by the community

this is still a problem i ran into in HEAD when working on http://drupal.org/node/180432

tested, and works as advertized.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Gábor Hojtsy’s picture

Version: 6.x-dev » 5.x-dev
Status: Fixed » Patch (to be ported)

Erm, also an issue in 5.x, so needs backporting.

marcingy’s picture

Status: Patch (to be ported) » Closed (won't fix)

Marking as won't fix as d5 is end of life.