From cee45175179969f5bae9c170cdbe082e007be988 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Mon, 30 Jan 2023 16:37:45 -0600 Subject: [PATCH] Suppress PHP warnings that are handled by PHP Safe --- lib/Ebook.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Ebook.php b/lib/Ebook.php index 715d8db5..8fce9b51 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -104,7 +104,9 @@ class Ebook{ $this->TextUrl = $this->Url . '/text'; try{ - $bytes = filesize($this->WwwFilesystemPath . '/text/single-page.xhtml'); + // PHP Safe throws an exception from filesize() if the file doesn't exist, but PHP still + // emits a warning. So, just silence the warning. + $bytes = @filesize($this->WwwFilesystemPath . '/text/single-page.xhtml'); $sizes = 'BKMGTP'; $factor = floor((strlen($bytes) - 1) / 3); $this->TextSinglePageSizeNumber = sprintf('%.1f', $bytes / pow(1024, $factor));