Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dando erro na hora de gerar o meu Danfce. Qual é a Solução? #572

Open
isaacrochaoliveira opened this issue Mar 6, 2023 · 13 comments
Open

Comments

@isaacrochaoliveira
Copy link

O Seguinte erro é: Cannot access offset of type string on string -- Eu não sei aonde se localiza esse erro. Alguém pode me ajudar?

@nagahshi
Copy link

nagahshi commented Mar 6, 2023

Faz um downgrade na versão do PHP pra 7.2 e testa

@isaacrochaoliveira
Copy link
Author

isaacrochaoliveira commented Mar 6, 2023

Não deu certo! Ocorre o msm erro

@isaacrochaoliveira
Copy link
Author

O erro está na hora de renderizar o PDF, com esse código -> $pdf = $danfce->render();

@nagahshi
Copy link

nagahshi commented Mar 6, 2023

poderia anexar o XML pra mim poder te ajudar ?

@isaacrochaoliveira
Copy link
Author

<?xml version="1.0" encoding="UTF-8"?><nfeProc versao="4.00" xmlns="http://www.portalfiscal.inf.br/nfe"><NFe xmlns="http://www.portalfiscal.inf.br/nfe"><infNFe Id="NFe52230326160589000189650010000006221744673588" versao="4.00"><ide><cUF>52</cUF><cNF>74467358</cNF><natOp>Venda de Mercadoria</natOp><mod>65</mod><serie>1</serie><nNF>622</nNF><dhEmi>2023-03-06T16:02:54-03:00</dhEmi><tpNF>1</tpNF><idDest>1</idDest><cMunFG>5208707</cMunFG><tpImp>4</tpImp><tpEmis>1</tpEmis><cDV>8</cDV><tpAmb>2</tpAmb><finNFe>1</finNFe><indFinal>1</indFinal><indPres>1</indPres><indIntermed>0</indIntermed><procEmi>0</procEmi><verProc>1.0</verProc></ide><emit><CNPJ>26160589000189</CNPJ><xNome>ANACAR BATERIAS EIRELI</xNome><xFant>ANACAR BATERIAS</xFant><enderEmit><xLgr>12</xLgr><nro>12</nro><xCpl>Qd. 90 Lt. 3</xCpl><xBairro>Setor Pedro Ludovico</xBairro><cMun>5208707</cMun><xMun>Goiania</xMun><UF>GO</UF><CEP>74825110</CEP><cPais>1058</cPais><xPais>Brasil</xPais><fone>6232416119</fone></enderEmit><IE>106782371</IE><CRT>1</CRT></emit><dest><CPF>77581911187</CPF><xNome>NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL</xNome><enderDest><xLgr>Rua L 17 Quadra 62 Lote 20</xLgr><nro>S/N</nro><xCpl>Rua Fundacao Bradesco</xCpl><xBairro>Papillon Park</xBairro><cMun>5201405</cMun><xMun>Ap-de Goiania</xMun><UF>GO</UF><CEP>74950230</CEP><cPais>1058</cPais><xPais>Brasil</xPais><fone>6235195047</fone></enderDest><indIEDest>9</indIEDest><IM>1</IM><email>[email protected]</email></dest><det nItem="1"><prod><cProd>33</cProd><cEAN>SEM GTIN</cEAN><xProd>NOTA FISCAL EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL</xProd><NCM>85167910</NCM><CFOP>5102</CFOP><uCom>UNID</uCom><qCom>1.0000</qCom><vUnCom>30.0000000000</vUnCom><vProd>30.00</vProd><cEANTrib>SEM GTIN</cEANTrib><uTrib>UNID</uTrib><qTrib>1.0000</qTrib><vUnTrib>30.0000000000</vUnTrib><indTot>1</indTot><xPed>127</xPed><nItemPed>124</nItemPed></prod><imposto><ICMS><ICMSSN102><orig>0</orig><CSOSN>102</CSOSN></ICMSSN102></ICMS><PIS><PISNT><CST>07</CST></PISNT></PIS><COFINS><COFINSNT><CST>07</CST></COFINSNT></COFINS></imposto></det><total><ICMSTot><vBC>0.00</vBC><vICMS>0.00</vICMS><vICMSDeson>0.00</vICMSDeson><vFCP>0.00</vFCP><vBCST>0.00</vBCST><vST>0.00</vST><vFCPST>0.00</vFCPST><vFCPSTRet>0.00</vFCPSTRet><vProd>30.00</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0.00</vII><vIPI>0.00</vIPI><vIPIDevol>0.00</vIPIDevol><vPIS>0.00</vPIS><vCOFINS>0.00</vCOFINS><vOutro>0.00</vOutro><vNF>30.00</vNF></ICMSTot></total><transp><modFrete>9</modFrete></transp><pag><detPag><indPag>0</indPag><tPag>01</tPag><vPag>30.00</vPag></detPag></pag></infNFe><infNFeSupl><qrCode>http://homolog.sefaz.go.gov.br/nfeweb/sites/nfce/danfeNFCe?p=52230326160589000189650010000006221744673588|2|2|1|61FA5BB98008472A17B2B6D64B260DED020067C8</qrCode><urlChave>www.nfce.go.gov.br/post/ver/214413/consulta-nfc-e-homologacao</urlChave></infNFeSupl><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI="#NFe52230326160589000189650010000006221744673588"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>lRpJo+tiVQTCIBKSOQlAJ9bBA3s=</DigestValue></Reference></SignedInfo><SignatureValue>hjh2zf3qc7S2FO8swQ+zVmYGPxV5jPDQdF9Zx/B2WrpmWNAIZkzSS6qim1Y39GxENtTYt/8QxethqHQSD7iJRedGxAPPIqnKszcuZH3AMUG/b5dGW4/p+VxG/QGYJyurqIO48TjIv7URwKwu1KgqPyqQsowHxQO5NPftpr+mrjO1frsZOopoDaDjx6KZdno3/kmxNg5QwoUU7R/kWV+AR4TblNLYqKgeHA/WP9dUvcrNHVkqJPEYC1cT5hay7dop9rBAs6tm6O3XKv6typPZ5W7REPHJ3+dajDTIdmkU/UPf7akioMoj7tKxeWvAAIylOms1EHVyeXeGcp3KUsHdbw==</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIHPzCCBSegAwIBAgIIXRsiEBg+ygIwDQYJKoZ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mms3hIHGmILsvihAuAOsJbIs+a/LN+9ZsrZw9Sdj2W9QGzt1YzRzaGkPVMolSILZl6C9AIzgEhI/PvYVuYeJPqsXHp/Rq3qO6H465ZNIyoSZ68mPk/Yn/dV7D7oDnQG4yNqC38Tvbe/zk2VuuxW4qsUQ+pi+78y5t1P977s4vDY8gm2E3PEYFiJTnEWYvDJUTcHWS8PMxUW1BN7mYWxQaKBSWC1sKqZ6NFGtiraha5S/WEjugYd2Uxa+6O4e3Zt9qNkzE6fmq6mF5S7gZAbTyzN+Ixxp0oua5R//vkUndmTIomCu+zNiQd5eF2Y=</X509Certificate></X509Data></KeyInfo></Signature></NFe><protNFe versao="4.00"><infProt><tpAmb>2</tpAmb><verAplic>GO4.0</verAplic><chNFe>52230326160589000189650010000006221744673588</chNFe><dhRecbto>2023-03-06T16:02:58-03:00</dhRecbto><nProt>152230024515427</nProt><digVal>lRpJo+tiVQTCIBKSOQlAJ9bBA3s=</digVal><cStat>100</cStat><xMotivo>Autorizado o uso da NF-e</xMotivo></infProt></protNFe></nfeProc>

@nagahshi
Copy link

nagahshi commented Mar 7, 2023

Bom dia amigo aqui esse XML está normal fiz assim e renderizou o pdf normalmente

`
$file = $request->file('file');

$fileLoaded = file_get_contents($file->getRealPath());

$da = new Danfce($fileLoaded);
$pdf = $da->render();

file_put_contents('/home/nme/Desktop/test.pdf', $pdf);
`

Ambiente:
ubuntu
PHP 7.4.3
sped-da e sped-common estão na dev-master, usei um projetinho 'lumen' pra facilitar aqui

Perguntei da versão do PHP pois esse erro geralmente está acontecendo

aqui usando
PHP 8.2
sped-da na dev-master e sped-common na 5.1.*
laravel 11

https://phpsandbox.io/e/x/np7y4?layout=EditorPreview&defaultPath=%2F&theme=dark&showExplorer=no&openedFiles=

provavelmente é algo no seu ambiente amigo :/

@isaacrochaoliveira
Copy link
Author

Obrigado! Vou verificar :)

@isaacrochaoliveira
Copy link
Author

Você acha que pode ser o sistema operacional? Eu uso Windows

@robmachado
Copy link
Contributor

A impressão funciona em linux, ruindows e em macOSx, é uma questão de ambiente do php

@isaacrochaoliveira
Copy link
Author

Você acha que pode ter alguma coisa a ver com minha versão do PHP ou outra coisa?

@nagahshi
Copy link

nagahshi commented Mar 8, 2023

Quase certeza amigo usa o https://phpsandbox.io voce monta um ambiente pra testar voce mesmo, esse erro comumente acontece nas versões superiores a 8 do PHP
pq antes só era um warning

roda no seu terminal php -v e confirma a versão do php que esta rodando no seu ambiente,

outra coisa importante, parece besteira, mas tem gente que não faz, espero que voce está usando o composer na instalação ele vai acusar se estiver faltando algum pacote

@isaacrochaoliveira
Copy link
Author

SIm, estou utilizando o composer e a versão é 8.1

@isaacrochaoliveira
Copy link
Author

Eu tbm já testei em versões abaixo do 8.0 mesmo assim continuar dando erro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants