[Tickets #14819] Re: Rdo throws inappropriate exception
noreply at bugs.horde.org
noreply at bugs.horde.org
Sun May 27 12:34:16 UTC 2018
BITTE NICHT AUF DIESE NACHRICHT ANTWORTEN. NACHRICHTEN AN DIESE
E-MAIL-ADRESSE WERDEN NICHT GELESEN.
Ticket-URL: https://bugs.horde.org/ticket/14819
------------------------------------------------------------------------------
Ticket | 14819
Aktualisiert Von | birnbacs at gmail.com
Zusammenfassung | Rdo throws inappropriate exception
Warteschlange | Horde Framework Packages
Typ | Bug
Status | Unconfirmed
Priorität | 1. Low
Milestone |
Patch | 1
Zuständige |
------------------------------------------------------------------------------
birnbacs at gmail.com (2018-05-27 12:33) hat geschrieben:
This is in reference to /usr/local/share/pear/Horde/Rdo/Base.php.
Among the problems I encounterd using a ONE_TO_ONE lazy relationship
is one where "a serious error" problem occurs when the target of the
relationship does not exist.
IOW I have an Rdo object A with a ONE_TO_ONE lazy relationship to Rdo
object B. If there is no object B an error is thrown upon any attempt
to access B (like in (if empty(B) { do_somthing }). This does not seem
to happen with any of the other relationships and it also appears to
be out of place.
I commented out line 132 where the Exception is thrown:
case Horde_Rdo::ONE_TO_ONE:
case Horde_Rdo::MANY_TO_ONE:
if (isset($rel['query'])) {
$query = $this->_fillPlaceholders($rel['query']);
$this->_fields[$field] = $m->findOne($query);
} elseif (!empty($this->{$rel['foreignKey']})) {
//$this->_fields[$field] =
$m->findOne($this->{$rel['foreignKey']});
$this->_fields[$field] =
$m->findOne(array($rel['foreignKey'] => $this->{$rel['foreignKey']}));
// amended SB 2018-05-23 to fix ONE_TO_ONE access problem
if (empty($this->_fields[$field])) {
//throw new Horde_Rdo_Exception('The referenced
object with key ' . $this->{$rel['foreignKey']} . ' does not exist.
Your data is inconsistent');
}
} else {
$this->_fields[$field] = null;
}
break;
Please note that the above code comprises another fix I introduced
recently (bug report pending).
I cannot see a situation where an empty result to the findOne() should
cause an exception - but am of course eager to learn the better.
More information about the bugs
mailing list