dboehmer / coocook

👨‍🍳🦉 Web application for collecting recipes and making food plans
https://coocook.org/
Other
11 stars 2 forks source link

$c->user() silently ignores inexistent methods #140

Closed dboehmer closed 3 years ago

dboehmer commented 3 years ago

$c->user is provided by Catalyst::Plugin::Session::Store::DBIC and transparently inherits our Result::User but it uses AUTOLOAD and silently ignores when inexistent methods are called.

This is a no-go in the upstream module. We need to either make sure it's fixed there or fix it in our code. This has just bitten me once again :rage:

dboehmer commented 3 years ago

The actual class doing AUTOLOAD is Catalyst::Authentication::User.

dboehmer commented 3 years ago

The problem is actually in https://metacpan.org/source/ILMARI/Catalyst-Authentication-Store-DBIx-Class-0.1506/lib%2FCatalyst%2FAuthentication%2FStore%2FDBIx%2FClass%2FUser.pm#L293-294

    if (my $code = $self->_user->can($method)) {
        return $self->_user->$code(@_);
    }
    elsif (my $accessor =
         try { $self->_user->result_source->column_info($method)->{accessor} }) {
        return $self->_user->$accessor(@_);
    } else {
        # XXX this should also throw
        return undef;
    }
dboehmer commented 3 years ago

See RT #97640