From dbc05f306915b0904830b5f39a7785f759b04f00 Mon Sep 17 00:00:00 2001 From: Marcos Brendon De Paula Date: Mon, 7 Oct 2024 11:20:59 -0300 Subject: [PATCH] =?UTF-8?q?Corrige=20valida=C3=A7=C3=A3o=20ao=20gerar=20MD?= =?UTF-8?q?F-e=20quando=20RNTRC=20n=C3=A3o=20=C3=A9=20obrigat=C3=B3rio=20(?= =?UTF-8?q?Fixes=20#576)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adicionada uma verificação adicional para garantir que a tag infANTT esteja definida antes de tentar acessar RNTRC. Verificado se RNTRC está presente dentro de infANTT antes de acessar seu valor, prevenindo assim a exceção. --- src/MDFe/Damdfe.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MDFe/Damdfe.php b/src/MDFe/Damdfe.php index 219d43cf..2e97621e 100644 --- a/src/MDFe/Damdfe.php +++ b/src/MDFe/Damdfe.php @@ -168,8 +168,10 @@ private function loadDoc($xml) if (!empty($this->rodo)) { $this->RNTRC = ""; $infANTT = $this->rodo->getElementsByTagName("infANTT")->item(0); - if (!empty($infANTT) && isset($infANTT->getElementsByTagName("RNTRC")->item(0)->nodeValue)) { - $this->RNTRC = $infANTT->getElementsByTagName("RNTRC")->item(0)->nodeValue; + if(isset($infANTT)){ + if (isset($infANTT->getElementsByTagName("RNTRC")->item(0)->nodeValue)) { + $this->RNTRC = $infANTT->getElementsByTagName("RNTRC")->item(0)->nodeValue; + } } } $this->ciot = "";