Problem/Motivation

There is a bug in the method loadStatic() of the UcAddressesAddressBook class. When loading a single address using the method loadAddress() (which calls loadStatic()), an error (notice) will occur if the address couldn't be found in the database.
Currently, nowhere in the module this method is called, so this error should never occur when no modules are used that extend Ubercart Addresses. However, other modules may call this method and it's likely it will be called too by Ubercart Addresses itself when Entity API integration is completed (because entities are usually loaded by giving the ID only, and the loadAddress() method should only be used when the address ID is known, but not the user ID).

Affected versions

This is a bug in both 7.x-1.x and 6.x-2.x.

Proposed resolution

In the method loadStatic(), check if loading from the database was successful. Implement/adjust an automated test to ensure that the bug is fixed.

Remaining tasks

  • Implement fix for the bug.
  • Implement/adjust an automated test to ensure that the bug is fixed.

User interface changes

None.

API changes

None.

Patch will follow.

Comments

megachriz’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new1.28 KB

The attached patch adds a check for if an address was loaded successful, in the loadStatic() method.

A test to confirm the bug is fixed, still needs to be written.

megachriz’s picture

I forgot that I already had written a test for this case a while ago.

New patch adjusts the API test case.

megachriz’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

Committed to 7.x-1.x version.

Needs backport to the 6.x-2.x version.

megachriz’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new3.57 KB

Patch for the 6.x-2.x version, based on the patch in #2.

megachriz’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Fixed

Committed #4.

Change version back to the one the issue was originally reported for.

Status: Fixed » Closed (fixed)

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