summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-10-09 23:01:07 +0200
committerGitHub <noreply@github.com>2018-10-09 23:01:07 +0200
commit75dbfe1dc03748957f07eca5ac583bedc6fdba76 (patch)
tree692f90aa15f4e512581cf2cf06a9b240757aaaba /Bugzilla/WebService
parent2ae37c378b50b1ae16c35ce74999b19eb91af07d (diff)
downloadbugzilla-75dbfe1dc03748957f07eca5ac583bedc6fdba76.tar.gz
bugzilla-75dbfe1dc03748957f07eca5ac583bedc6fdba76.tar.xz
Bug 623384 - Use Module::Runtime instead of eval { require } or eval "use"
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r--Bugzilla/WebService/Server.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/Bugzilla/WebService/Server.pm b/Bugzilla/WebService/Server.pm
index a76c4c48c..e02788911 100644
--- a/Bugzilla/WebService/Server.pm
+++ b/Bugzilla/WebService/Server.pm
@@ -11,12 +11,15 @@ use 5.10.1;
use strict;
use warnings;
+use Bugzilla::Logging;
use Bugzilla::Error;
use Bugzilla::Util qw(datetime_from);
use Digest::MD5 qw(md5_base64);
use Scalar::Util qw(blessed);
use Storable qw(freeze);
+use Module::Runtime qw(require_module);
+use Try::Tiny;
sub handle_login {
my ($self, $class, $method, $full_method) = @_;
@@ -30,8 +33,13 @@ sub handle_login {
Bugzilla->request_cache->{dont_persist_session} = 1;
}
- eval "require $class";
- ThrowCodeError('unknown_method', {method => $full_method}) if $@;
+ try {
+ require_module($class);
+ }
+ catch {
+ ThrowCodeError('unknown_method', {method => $full_method});
+ FATAL($_);
+ };
return if ($class->login_exempt($method)
and !defined Bugzilla->input_params->{Bugzilla_login});
Bugzilla->login();