Commit 609fc9ae authored by Patrick Schmalstig's avatar Patrick Schmalstig
Browse files

Fixed MANTIS-5735 (Improper handling of missing field types)

parent 0ec983fb
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -391,12 +391,18 @@ function get_fields_hook(string $type) : object

    // Try creating an object factory as a last resort
    $path = 'hooks/systems/fields/' . filter_naughty($type);
    set_throw_errors(true);
    try {
        require_code($path);
        $ob = object_factory('Hook_fields_' . filter_naughty($type));
        if (is_object($ob)) {
            $fields_hook_cache[$type] = $ob;
            return $ob;
        }
    } catch (CMSException $e) {
        $ob = null;
    }
    set_throw_errors(false);

    // We got nothing; fall back to short_text
    if ($type == 'short_text') { // Uh oh! We already tried short_text.