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
Comment #1
megachrizThe 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.
Comment #2
megachrizI forgot that I already had written a test for this case a while ago.
New patch adjusts the API test case.
Comment #3
megachrizCommitted to 7.x-1.x version.
Needs backport to the 6.x-2.x version.
Comment #4
megachrizPatch for the 6.x-2.x version, based on the patch in #2.
Comment #5
megachrizCommitted #4.
Change version back to the one the issue was originally reported for.