@@ -102,10 +102,13 @@ public function __construct($source, $style = null, $isWatermark = false)
102102 // Check supported types
103103 if ($ this ->isMemImage ) {
104104 $ supportedTypes = array ('image/jpeg ' , 'image/gif ' , 'image/png ' );
105- $ imgData = getimagesize ($ source );
105+ $ imgData = @getimagesize ($ source );
106+ if (!is_array ($ imgData )) {
107+ throw new InvalidImageException ();
108+ }
106109 $ this ->imageType = $ imgData ['mime ' ]; // string
107110 if (!in_array ($ this ->imageType , $ supportedTypes )) {
108- throw new UnsupportedImageTypeException ;
111+ throw new UnsupportedImageTypeException () ;
109112 }
110113 } else {
111114 $ supportedTypes = array (
@@ -114,17 +117,19 @@ public function __construct($source, $style = null, $isWatermark = false)
114117 \IMAGETYPE_TIFF_II , \IMAGETYPE_TIFF_MM
115118 );
116119 if (!file_exists ($ source )) {
117- throw new InvalidImageException ;
120+ throw new InvalidImageException () ;
118121 }
119122 $ imgData = getimagesize ($ source );
120123 if (function_exists ('exif_imagetype ' )) {
121124 $ this ->imageType = exif_imagetype ($ source );
122125 } else {
126+ // @codeCoverageIgnoreStart
123127 $ tmp = getimagesize ($ source );
124128 $ this ->imageType = $ tmp [2 ];
129+ // @codeCoverageIgnoreEnd
125130 }
126131 if (!in_array ($ this ->imageType , $ supportedTypes )) {
127- throw new UnsupportedImageTypeException ;
132+ throw new UnsupportedImageTypeException () ;
128133 }
129134 $ this ->imageType = \image_type_to_mime_type ($ this ->imageType );
130135 }
0 commit comments