Permalink
Browse files

[delivers #18667851] Force C4::Context->preference() to return scalar

If a pref is not registered, preference() returns a context-dependent
value.  Lots of code, in particular in C4::Auth::get_user_and_template,
calls preference() from a list context, and that can cause things like
setting values in a hash to have empty lists as values, which ends up
being a non-value, and completely rearranging the var/val relationships
that ought to be set.
  • Loading branch information...
1 parent 5978daa commit c349c16aafd8e6d4df77045f55d9b16cd2944758 @ctfliblime ctfliblime committed Sep 22, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 C4/Context.pm
View
@@ -551,7 +551,7 @@ sub preference {
# croak "Systempreference '$var' is not registered" if !defined $new_var;
if (!defined $new_var) {
carp "Systempreference '$var' is not registered";
- return;
+ return undef;
}
# Otherwise write the variable to the DB

0 comments on commit c349c16

Please sign in to comment.