From bb81e9e0c37a302d4ae7e30aca53f5c3f2e9b404 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 20 Dec 2014 14:00:48 -0800 Subject: [PATCH] Fix weird "Default object created from empty vlaue" error Looks like $file can be NULL sometimes, though that should be illegal. Probably an unfixed post.php bug... --- inc/display.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/display.php b/inc/display.php index 9561c4b8..929f2a91 100644 --- a/inc/display.php +++ b/inc/display.php @@ -357,9 +357,14 @@ class Post { if (isset($this->files) && $this->files) { $this->files = json_decode($this->files); // Compatibility for posts before individual file hashing - foreach ($this->files as &$file) + foreach ($this->files as $i => &$file) { + if (empty($file)) { + unset($this->files[$i]); + continue; + } if (!isset($file->hash)) $file->hash = $this->filehash; + } } $this->subject = utf8tohtml($this->subject);