Problem/Motivation

If a taxon has a uuid assigned, but it's empty, it *cannot* currently be updated by the uuid_taxonomy update $op.

Steps to reproduce. 1. Set a taxon's uuid to empty. 2. Try to update it. It will not update, which means, you can't fix deleted data.

This is a similar issue to the one I reported in #1599496: On $op update: if uuid value was empty in node_uuid table, uuid module assumes NO uuid and attempts sql INSERT, which fails.

Proposed resolution

The current code in the update op of the hook does this:

<?php
      $existing_uuid = db_result(db_query("SELECT uuid FROM {$table} WHERE $keyfield = %d", $key));
      if ($existing_uuid) {

?>

My proposal is to only test for a failed request (ie, NO row, rather than an empty row, by changing the test.

<?php
      $existing_uuid = db_result(db_query("SELECT uuid FROM {$table} WHERE $keyfield = %d", $key));
      if ($existing_uuid!==FALSE) {
?>

This will allow even an empty row to be updated/repaired, and will not affect any other functionality.

Remaining tasks

Patch to be provided and tested.

User interface changes

none.

API changes

none.

Comments

apotek’s picture

Status: Active » Needs review
StatusFileSize
new932 bytes

And here's the patch for this issue.

markdorison’s picture

I would add spaces around the operator on the following line to comply with coding style standards:

if ($existing_uuid!==FALSE) {

Otherwise, this looks good to me.

skwashd’s picture

Status: Needs review » Needs work
+++ b/uuid.moduleundefined
@@ -286,7 +286,7 @@ function uuid_taxonomy($op, $type, $array = NULL) {
+      if ($existing_uuid!==FALSE) {

I agree with @markdorison on this one. You need a space either side of the comparison operator. Other than that I'd be happy to apply it.

apotek’s picture

Status: Needs work » Needs review
StatusFileSize
new925 bytes

@skwashd I'm happy to re-roll this patch with your suggestions.

/me re-rolls

Here you go....

apotek’s picture

Ok. This got stuck too. Trying again.

[Update:] Evidently these tests are postponed because the 6.x-1.x branch of the uuid module is failing tests.

Message	Group	Filename	Line	Function	Status
Undefined property: stdClass::$uuid	Notice	uuid.test	289	UUIDFunctionalityTestCase->testDisabledNodeUUID()	
Node uuid is being returned correctly.	Node UUID	uuid.test	292	UUIDFunctionalityTestCase->testDisabledNodeUUID()	
Undefined property: stdClass::$revision_uuid	Notice	uuid.test	301	UUIDFunctionalityTestCase->testDisabledNodeUUID()	
Node revision uuid is being returned correctly.	Node Revision UUID	uuid.test	304	UUIDFunctionalityTestCase->testDisabledNodeUUID()	
apotek’s picture

@skwashd The dev branch of this module is marked unstable for failed tests, so no further tests can be run on patches against the branch. We're stuck. Do you need help getting the dev branch stable?

apotek’s picture

*crickets*

skwashd’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Drupal 6 core is no longer supported. We are no longer supporting 6.x-1.x versions of this module. I am closing this issue as won't fix.