From 6d632320a68acb63554bc7b6a8b7bdbd7971b79f Mon Sep 17 00:00:00 2001 From: camer0n Date: Mon, 30 Oct 2023 07:28:14 -0700 Subject: [PATCH] Issue #5079 PHP Warning. --- e107_handlers/e_parse_class.php | 8 ++++---- e107_tests/tests/unit/e_parseTest.php | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 0bc31d03f..94ae23238 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -2316,10 +2316,10 @@ class e_parse // cleanup. $newOpts = array( - 'w' => (string) intval($options['w']), - 'h' => (string) intval($options['h']), - 'aw' => (string) intval($options['aw']), - 'ah' => (string) intval($options['ah']), + 'w' => isset($options['w']) ? (string) intval($options['w']) : '', + 'h' => isset($options['h']) ? (string) intval($options['h']) : '', + 'aw' => isset($options['aw']) ? (string) intval($options['aw']) : '', + 'ah' => isset($options['ah']) ? (string) intval($options['ah']) : '', 'c' => strtoupper(vartrue($options['c'], '0')), ); diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php index b4b402a0f..271a18010 100644 --- a/e107_tests/tests/unit/e_parseTest.php +++ b/e107_tests/tests/unit/e_parseTest.php @@ -1374,6 +1374,11 @@ EXPECTED; 'options' => array('w' => 222, 'h' => 272, 'aw' => 0, 'ah' => 0, 'c' => 0, 'type' => 'webp'), 'expected' => array('prefix' => 'thumb_butterfly_', 'suffix' => '.webp.cache.bin'), ), + 2 => array( + 'file' => 'e107_plugins/gallery/images/butterfly.jpg', + 'options' => array('w' => 222, 'h' => 272, 'c' => 0, 'type' => 'webp'), + 'expected' => array('prefix' => 'thumb_butterfly_', 'suffix' => '.webp.cache.bin'), + ), );