File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -344,6 +344,9 @@ public function mapRawData(array $data): array
344344 $ rotate = true ;
345345 }
346346 }
347+ if (!isset ($ value_split [0 ]) || !isset ($ value_split [1 ])) {
348+ continue 2 ;
349+ }
347350 if (!array_key_exists (Exif::WIDTH , $ mappedData )) {
348351 if (!($ rotate )) {
349352 $ mappedData [Exif::WIDTH ] = intval ($ value_split [0 ]);
@@ -410,7 +413,9 @@ protected function extractGPSCoordinates(mixed $coordinates): float|false
410413 if (preg_match ('!^([0-9.]+) deg ([0-9.]+) \' ([0-9.]+)"! ' , $ coordinates , $ matches ) === 0 ) {
411414 return false ;
412415 }
413-
416+ if (!isset ($ matches [1 ]) || !isset ($ matches [2 ]) || !isset ($ matches [3 ])) {
417+ return false ;
418+ }
414419 return round (
415420 floatval ($ matches [1 ]) + (floatval ($ matches [2 ]) / 60 ) + (floatval ($ matches [3 ]) / 3600 ),
416421 self ::ROUNDING_PRECISION
Original file line number Diff line number Diff line change @@ -278,9 +278,12 @@ protected function extractGPSCoordinates(string $coordinates): float|false
278278 if (preg_match ($ m , $ coordinates , $ matches ) === 0 ) {
279279 return false ;
280280 }
281+ if (!isset ($ matches [1 ])) {
282+ return false ;
283+ }
281284 $ degrees = $ this ->normalizeComponent ($ matches [1 ]);
282- $ minutes = $ this ->normalizeComponent ($ matches [2 ] ?? 0 );
283- $ seconds = $ this ->normalizeComponent ($ matches [3 ] ?? 0 );
285+ $ minutes = $ this ->normalizeComponent ($ matches [2 ] ?? ' 0 ' );
286+ $ seconds = $ this ->normalizeComponent ($ matches [3 ] ?? ' 0 ' );
284287 if ($ degrees === false || $ minutes === false || $ seconds === false ) {
285288 return false ;
286289 }
You can’t perform that action at this time.
0 commit comments