[Koha-bugs] [Bug 28700] "Unblessed" method in Object.pm has blessed values for keys in some cases

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Sep 21 15:21:01 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28700

--- Comment #10 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
If we do

  $self->attribute( dt_from_string );

the 'attribute' will obviously have a DateTime in it, as Koha::Object-derived
objects are just blessed hashrefs. We could be doing any weird stuff on those
assignments.

So far we have sticked to the 'know what you're doing' approach, so if you know
you don't care about the stored object, just move on; and if you need it, you
call ->discard_changes.

I'm inclined to think we should keep it like this, and in this particular case
assume there's a bug in Koha::Item->store, which is callig $self->SUPER::store
and then tries to use the resulting object without calling ->discard_changes as
it should.

I can see reasons to prefer not to call ->discard_changes all the time (in API
controllers it is a common mistake not to do it, yielding super weird and hard
to debug errors). But the tradeoff tells me it is not worth making it implicit.

That's my honest opinion on the subject.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list