From f55859ceba856e3890e1e2775b68d1d60e6c258d Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 16 Dec 2016 22:18:14 -0800 Subject: [PATCH] Throw Exception on cachefile write error --- src/Output/QRImage.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Output/QRImage.php b/src/Output/QRImage.php index 7a5d1cdae..0691d124e 100644 --- a/src/Output/QRImage.php +++ b/src/Output/QRImage.php @@ -166,7 +166,9 @@ class QRImage extends QROutputAbstract{ // if saving to file, append the correct headers if($this->options->cachefile){ - @file_put_contents($this->options->cachefile, '' . "\n" . $imageData); + if(false === @file_put_contents($this->options->cachefile, '' . "\n" . $imageData)){ + throw new QRCodeOutputException('Could not write to cache file.'); + } } if((bool)$this->options->base64){