From da7bfcc4e207d38612201df69ef8cbe42e37b1da Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 21 May 2024 21:56:18 +1000 Subject: [PATCH] Fix for invalid-zone validation comparing a string with an int --- app/Classes/FTN/Message.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index 38fad90..4886307 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -307,10 +307,10 @@ class Message extends FTNBase switch ($key) { // From Addresses - case 'fz': return Arr::get($this->src,'z'); - case 'fn': return ($x=$this->src) ? Arr::get($x,'n') : Arr::get($this->header,'onet'); - case 'ff': return ($x=$this->src) ? Arr::get($x,'f') : Arr::get($this->header,'onode'); - case 'fp': return $this->mo->kludges->get('FMPT:') ?: Arr::get($this->src,'p',Arr::get($this->header,'opoint',0)); + case 'fz': return (int)Arr::get($this->src,'z'); + case 'fn': return (int)($x=$this->src) ? Arr::get($x,'n') : Arr::get($this->header,'onet'); + case 'ff': return (int)($x=$this->src) ? Arr::get($x,'f') : Arr::get($this->header,'onode'); + case 'fp': return (int)$this->mo->kludges->get('FMPT:') ?: Arr::get($this->src,'p',Arr::get($this->header,'opoint',0)); case 'fd': return Arr::get($this->src,'d'); case 'fzone': @@ -341,10 +341,10 @@ class Message extends FTNBase // To Addresses // Echomail doesnt have a zone, so we'll use the source zone - case 'tz': return Arr::get($this->isEchomail() ? $this->src : $this->dst,'z'); - case 'tn': return Arr::get($this->header,'dnet'); - case 'tf': return Arr::get($this->header,'dnode'); - case 'tp': return $this->mo->kludges->get('TOPT:') ?: Arr::get($this->header,'dpoint',0); + case 'tz': return (int)Arr::get($this->isEchomail() ? $this->src : $this->dst,'z'); + case 'tn': return (int)Arr::get($this->header,'dnet'); + case 'tf': return (int)Arr::get($this->header,'dnode'); + case 'tp': return (int)$this->mo->kludges->get('TOPT:') ?: Arr::get($this->header,'dpoint',0); case 'tzone': // Use the zone if this class was called with it. @@ -360,6 +360,7 @@ class Message extends FTNBase return Zone::where('zone_id',$this->tz) ->where('default',TRUE) ->single(); + case 'tdomain': // We'll use the zone's domain if this method class was called with a zone if ($this->zone && (($this->zone->domain->name === Arr::get($this->dst,'d')) || ! Arr::get($this->dst,'d')))