nemiah / phpFinTS

PHP library to communicate with FinTS/HBCI servers
MIT License
130 stars 42 forks source link

Special Chars ('') in name of transaction crahes getStatements-loop #334

Closed acsig closed 3 years ago

acsig commented 3 years ago

Today the fetching of transactions of our account always stopped after a certain transaction. The of the account owner of the transaction was M''2 xxxx Gmbh. I think the '' are causing the problems while processing.

Here's an excerpt of the response:

:61:2103120312CR238,00N062NONREF
:86:168?00ECHTZEIT-GUTSCHRIFT?109251?20EREF+MOB.71.EE.24675?21SVW
Z+RechnungsNr 138200 Kun?22denNr U###### AnzahlungsId?23 D3####
KWSK2?31DE#############?32M''2 ####### GMBH
:61:2103120312CR357,00N062NONREF

There where several transactions after this one, but the loops always stops after this transaction.

What I did was:


 $oFints = new FinTs(#######);
            $aAccounts = $oFints->getSEPAAccounts();
            $oFirstAccount = $aAccounts[1];
            $dFrom = new \DateTime(date('Y-m-d', time()-$iHours*60*60));
            $dTo   = new \DateTime();
            $oAuszug = $oFints->getStatementOfAccount($oFirstAccount, $dFrom, $dTo);
            foreach ($oAuszug->getStatements() as $aStatement) {
                foreach ($aStatement->getTransactions() as $oTransaction) {
                    $this->logger->info("Transaktionsbetrag:".$oTransaction->getAmount());
    ....
  }
  }

Any idea how I can fix the problem?

Philipp91 commented 3 years ago

It looks like you're using a very old version of the library. Tripping over '' sounds like exactly the kind of bug that the old parser would have had.

acsig commented 3 years ago

Thank you for the hint. It took a while to upgrade to 3.2 and adjusting my code to the current version. Now it works fine