From 9d9618ee68405e81f12737f7ebfa714b6e191e84 Mon Sep 17 00:00:00 2001 From: tianya Date: Wed, 23 Feb 2022 23:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3php7+=E4=B8=8B=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/dedetag.class.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/include/dedetag.class.php b/src/include/dedetag.class.php index f36131a7..16a61712 100755 --- a/src/include/dedetag.class.php +++ b/src/include/dedetag.class.php @@ -613,10 +613,15 @@ class DedeTagParse $phpcode = $refObj->GetInnerText(); } $phpcode = preg_replace("/'@me'|\"@me\"|@me/i", '$DedeMeValue', $phpcode); - @eval($phpcode); //or die("$phpcode"); + try { + @eval($phpcode); + + $this->CTags[$i]->TagValue = $DedeMeValue; + $this->CTags[$i]->IsReplace = TRUE; + } catch (Exception $e) { + //or die("$phpcode"); + } - $this->CTags[$i]->TagValue = $DedeMeValue; - $this->CTags[$i]->IsReplace = TRUE; } /** @@ -869,12 +874,18 @@ class DedeTagParse $functionname = str_replace("\"}", "\"]", $functionname); $functionname = preg_replace("/'@me'|\"@me\"|@me/i", '$DedeFieldValue', $functionname); $functionname = "\$DedeFieldValue = ".$functionname; - @eval($functionname.";"); //or die("$functionname"); - if (empty($DedeFieldValue)) { + try { + @eval($functionname.";"); + if (empty($DedeFieldValue)) { + return ''; + } else { + return $DedeFieldValue; + } + } catch (Exception $e) { + //or die("$functionname"); return ''; - } else { - return $DedeFieldValue; } + } /**