From 4142c76aa9b7d46efdb4357dd1e33f6ffd580aab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:55:09 +0000 Subject: [PATCH 2/3] fix: validate getimagesize() return value before accessing width/height Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com> --- web/includes/functions.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 3386d04fe..8f2a320ff 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -523,8 +523,12 @@ function getFormChanges($values, $newValues, $types=false, $columns=false) { case 'image' : if ( is_array( $newValues[$key] ) ) { $imageData = getimagesize( $newValues[$key]['tmp_name'] ); - $changes[$key.'Width'] = $key.'Width = '.intval($imageData[0]); - $changes[$key.'Height'] = $key.'Height = '.intval($imageData[1]); + if ( !is_array($imageData) ) { + ZM\Warning("getimagesize failed for uploaded file '$key'; skipping width/height update."); + } else { + $changes[$key.'Width'] = $key.'Width = '.intval($imageData[0]); + $changes[$key.'Height'] = $key.'Height = '.intval($imageData[1]); + } $changes[$key.'Type'] = $key.'Type = '.dbEscape($newValues[$key]['type']); $changes[$key.'Size'] = $key.'Size = '.intval($newValues[$key]['size']); ob_start(); @@ -537,7 +541,6 @@ function getFormChanges($values, $newValues, $types=false, $columns=false) { break; case 'document' : if ( is_array( $newValues[$key] ) ) { - $imageData = getimagesize( $newValues[$key]['tmp_name'] ); $changes[$key.'Type'] = $key.'Type = '.dbEscape($newValues[$key]['type']); $changes[$key.'Size'] = $key.'Size = '.intval($newValues[$key]['size']); ob_start(); From d56f0e3985b6d5f2c4147673f767710300e7315d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:55:35 +0000 Subject: [PATCH 3/3] fix: clarify warning message field vs file wording Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com> --- web/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 8f2a320ff..97df2ea75 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -524,7 +524,7 @@ function getFormChanges($values, $newValues, $types=false, $columns=false) { if ( is_array( $newValues[$key] ) ) { $imageData = getimagesize( $newValues[$key]['tmp_name'] ); if ( !is_array($imageData) ) { - ZM\Warning("getimagesize failed for uploaded file '$key'; skipping width/height update."); + ZM\Warning("getimagesize failed for uploaded field '$key'; skipping width/height update."); } else { $changes[$key.'Width'] = $key.'Width = '.intval($imageData[0]); $changes[$key.'Height'] = $key.'Height = '.intval($imageData[1]);