From 2b76785a13df36419959e64395c0494385c2e98f Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 28 Jun 2016 20:17:04 -0700 Subject: [PATCH] Better 404 for Phame Summary: "Fixes" fatals on phacility.com blog. If post_id is either `0` or any other integer not in the blog system, show a normal Phame 404 with crumbs. Test Plan: http://local.blog.phacility.com/post/0/last_published/, http://local.blog.phacility.com/post/999999/last_published/ Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D16192 --- src/applications/phame/controller/PhameLiveController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/applications/phame/controller/PhameLiveController.php b/src/applications/phame/controller/PhameLiveController.php index ba2b65d9f8..1287a33f35 100644 --- a/src/applications/phame/controller/PhameLiveController.php +++ b/src/applications/phame/controller/PhameLiveController.php @@ -87,7 +87,7 @@ abstract class PhameLiveController extends PhameController { $this->isExternal = $is_external; $this->isLive = $is_live; - if ($post_id) { + if (strlen($post_id)) { $post_query = id(new PhamePostQuery()) ->setViewer($viewer) ->withIDs(array($post_id)); @@ -104,6 +104,8 @@ abstract class PhameLiveController extends PhameController { $post = $post_query->executeOne(); if (!$post) { + // Not a valid Post + $this->blog = $blog; return new Aphront404Response(); }