PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #6555

Can't update register with id 0

Details

Request #6555Can't update register with id 0
Submitted2006-01-23 03:51 UTC
Fromvtamara at pasosdejesus dot org
StatusSuspended
PackageDB_DataObject
PHP VersionIrrelevant
OSAny
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.