So I was moving my images around in my Gallery when I noticed that it didn’t throw 404 File Not Found pages whenever I tried an invalid path under /v/, but threw this were ERROR_MISSING_OBJECT message instead:
Error
Error (ERROR_MISSING_OBJECT) :in modules/core/classes/helpers/GalleryFileSystemEntityHelper_simple.class at line 121 (GalleryCoreApi::error)
in modules/core/classes/GalleryCoreApi.class at line 1940 (GalleryFileSystemEntityHelper_simple::fetchChildIdByPathComponent)
in modules/core/classes/helpers/GalleryFileSystemEntityHelper_simple.class at line 64 (GalleryCoreApi::fetchChildIdByPathComponent)
in modules/core/classes/GalleryCoreApi.class at line 1883 (GalleryFileSystemEntityHelper_simple::fetchItemIdByPath)
in modules/rewrite/classes/RewriteSimpleHelper.class at line 50 (GalleryCoreApi::fetchItemIdByPath)
in ??? at line 0 (RewriteSimpleHelper::loadItemIdFromPath)
in modules/rewrite/classes/RewriteUrlGenerator.class at line 98
in modules/rewrite/classes/parsers/modrewrite/ModRewriteUrlGenerator.class at line 50 (RewriteUrlGenerator::_onLoad)
in init.inc at line 113 (ModRewriteUrlGenerator::init)
in main.php at line 73
Gallery forums weren’t much help as they just told you to go modify the code yourself.
Using the PHP: header – Manual, I modified that code path to actually return to my homepage:
header("Location: /gallery/main.php");
You can make it return a 404 error if you prefer with:
header("HTTP/1.0 404 Not Found");
The place to modify this is in modules/core/classes/helpers/ GalleryFileSystemEntityHelper_simple.class on line 119. Comment out the following 2 lines:
//return array(GalleryCoreApi::error(ERROR_MISSING_OBJECT, __FILE__, __LINE__,
//"Parent $parentId path $pathComponent"), null);
and insert the header of your choice followed by:
exit();
since you don’t want it to continue.
I also noticed if you do the following, it’ll return you to the homepage, though I can’t garuantee that since I’m not exactly sure what it’s really doing:
return array(null, 0);