Home » Database » DB_DataObject » Bug #6555
Can't update register with id 0
Details
| Request #6555 | Can't update register with id 0 |
|---|---|
| Submitted | 2006-01-23 03:51 UTC |
| From | vtamara at pasosdejesus dot org |
| Status | Suspended |
| Package | DB_DataObject |
| PHP Version | Irrelevant |
| OS | Any |
| Roadmaps | (Not assigned) |
Comments
[2006-01-23 03:51 UTC] vtamara at pasosdejesus dot org
Description:
------------
The function update (even in CVS) includes the following piece of code:
if (empty($this->{$keys[0]}) && $dataObject !== true) {
$this->raiseError("update: trying to perform an update without
the key set, and argument to update is not
DB_DATAOBJECT_WHEREADD_ONLY
", DB_DATAOBJECT_ERROR_INVALIDARGS);
return false;
}
Since the empty function returns true when its argument is
0, the error is produced also when the key of the DataObject
is 0.
In my humble opinion the condition of the if should be:
if ($this->{$keys[0]}!=0 &&
empty($this->{$keys[0]}) && $dataObject !== true) {
Am I right?
Best regards. Thanks for the good work. God illuminate us.