From db357e460a950ce49d5b4e2f0f667835efa1bc79 Mon Sep 17 00:00:00 2001 From: "Bryan J. Brown" Date: Thu, 5 Oct 2017 20:02:00 +0000 Subject: [PATCH] Reordered invalid PID check to catch more invalidity cases --- islandora.module | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/islandora.module b/islandora.module index c1fa89c7..833401c4 100644 --- a/islandora.module +++ b/islandora.module @@ -1226,18 +1226,17 @@ function islandora_object_load($object_id) { return $tuque->repository->getObject(urldecode($object_id)); } catch (Exception $e) { - if ($e->getCode() == '404') { + // Check to see if invalid PID was passed + module_load_include('inc', 'islandora', 'includes/utilities'); + if (!islandora_is_valid_pid($object_id)) { + watchdog('islandora', 'Failed to load invalid PID: @pid', array('@pid' => $object_id), WATCHDOG_ERROR); + return FALSE; + } + elseif ($e->getCode() == '404') { return FALSE; } else { - module_load_include('inc', 'islandora', 'includes/utilities'); - if (!islandora_is_valid_pid($object_id)) { - watchdog('islandora', 'Failed to load invalid PID: @pid', array('@pid' => $object_id), WATCHDOG_ERROR); - return FALSE; - } - else { - return NULL; - } + return NULL; } } }