From 9b37dcc9b853e109ce5ba3e1ae889703803ca3a5 Mon Sep 17 00:00:00 2001 From: "Bryan J. Brown" Date: Fri, 6 Oct 2017 19:51:32 -0400 Subject: [PATCH] Adds check for invalid PIDs to islandora_object_load fails (#689) * Adds check for invalid PIDs to islandora_object_load fails * Reordered invalid PID check to catch more invalidity cases * Exploring the logical limits of Drupal Coding Style * Removes watchdog logging when islandora_load_object gets a malformed PID --- islandora.module | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/islandora.module b/islandora.module index 29899c1b..0efc7cc4 100644 --- a/islandora.module +++ b/islandora.module @@ -1226,7 +1226,12 @@ function islandora_object_load($object_id) { return $tuque->repository->getObject(urldecode($object_id)); } catch (Exception $e) { - if ($e->getCode() == '404') { + // Check to see if tuque failure is due to invalid PID. + module_load_include('inc', 'islandora', 'includes/utilities'); + if (!islandora_is_valid_pid($object_id)) { + return FALSE; + } + elseif ($e->getCode() == '404') { return FALSE; } else {