From 5e2989ef24c3cfcde0a738141beed4c91cc10cbf Mon Sep 17 00:00:00 2001 From: xiaomlove <353856593@qq.com> Date: Thu, 25 Feb 2021 17:10:52 +0800 Subject: [PATCH] fixed: no gd enabled call gd_info() --- nexus/Install/Install.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index cc40fadd..c779ec35 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -113,7 +113,7 @@ class Install public function listRequirementTableRows() { - $gdInfo = gd_info(); + $gdInfo = method_exists('gd_info') ? gd_info() : []; $tableRows = [ [ 'label' => 'PHP version', @@ -148,23 +148,23 @@ class Install [ 'label' => 'PHP extension gd JPEG Support', 'required' => 'true', - 'current' => $gdInfo['JPEG Support'], - 'result' => $this->yesOrNo($gdInfo['JPEG Support']), + 'current' => $gdInfo['JPEG Support'] ?? '', + 'result' => $this->yesOrNo($gdInfo['JPEG Support'] ?? ''), ], [ 'label' => 'PHP extension gd PNG Support', 'required' => 'true', - 'current' => $gdInfo['PNG Support'], - 'result' => $this->yesOrNo($gdInfo['PNG Support']), + 'current' => $gdInfo['PNG Support'] ?? '', + 'result' => $this->yesOrNo($gdInfo['PNG Support'] ?? ''), ], [ 'label' => 'PHP extension gd GIF Read Support', 'required' => 'true', - 'current' => $gdInfo['GIF Read Support'], - 'result' => $this->yesOrNo($gdInfo['GIF Read Support']), + 'current' => $gdInfo['GIF Read Support'] ?? '', + 'result' => $this->yesOrNo($gdInfo['GIF Read Support'] ?? ''), ], ]; - $fails = array_filter($tableRows, function ($value) {return $value['required'] == 'true' && $value['result'] == 'NO';}); + $fails = array_filter($tableRows, function ($value) {return in_array($value['required'], ['true', 'enabled']) && $value['result'] == 'NO';}); $pass = empty($fails); return [