[Koha-bugs] [Bug 15759] Allow Koha::Object derived objects to be used as hashrefs
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Feb 8 16:54:35 CET 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15759
--- Comment #1 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 47740
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47740&action=edit
Bug 15759 - Allow Koha::Object derived objects to be used as hashrefs
On occasion, bugs in Koha have been revealed to be a mis-use of
Koha::Object. This seems to be due to our long standing use of hashrefs
for data in Koha.
For instance, a developer may accidentally write:
my $borrowernumber = $borrower->{borrowernumber};
instead of
my $borrowernumber = $borrower->borrowernumber;
Since our object is a blessed hashref, this does not cause an error.
Instead, we just access that key of the hashref, which is almost
certainly undefined.
With some extra code in Koha/Object.pm, we can allow hashref-like use of
our Objects, which will not only prevent these errors, but allow drop-in
use of Koha::Objects where we currently use hashrefs!
Test Plan:
1) Apply this patch
2) prove t/db_dependent/Borrower.t
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list