Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.3

Bug #14736 DTAU file silently wrong
Submitted: 2008-10-03 14:04 UTC
From: pmarek Assigned: mschuett
Status: Closed Package: Payment_DTA (version 1.2.0)
PHP Version: 5.2.5 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-10-03 14:04 UTC] pmarek (Philipp Marek)
Description: ------------ If the account number includes leading zeros, it is not rejected - but the generated DTAU is invalid. It is possible that this affects other fields as well - bank code, etc.

Comments

 [2008-10-05 17:21 UTC] doconnor (Daniel O'Connor)
Hey Philipp, I don't suppose there is any chance of an executable test script which demonstrates this behaviour?
 [2008-10-06 07:11 UTC] pmarek (Philipp Marek)
Here's the sample, changed to show the bug: <?php require_once("DTA.php"); $dta_file = new DTA(DTA_DEBIT); $dta_file->setAccountFileSender(array( "name" => "Michael Mustermann", "bank_code" => 11112222, "account_number" => 87654321 )); $dta_file->addExchange( array( "name" => "Franz Mueller", "bank_code" => 33334444, "account_number" => "000000000000000000000000000000000000000000013579000", ), 12.01, array( "Bill Nr. 01234", "Information" ) ); echo $dta_file->getFileContent(); ?>
 [2008-11-20 13:55 UTC] dogmasam (Steffen Müller)
The problem occurs not only with leading zeros, virtually any string longer than 10 (accounts) or 8 (bank code) characters breaks the file. This is caused by insufficient input sanitizing - the account numbers and bank codes are not checked for their lengtht, only padded if they are too short. I've added a patch that fixes the problem by cutting the string to the correct length - from right to left. Greetings, Sam
 [2008-11-29 21:27 UTC] mschuett (Martin Schütte)
In release 1.2.1 addExchange() rejects account numbers longer than 10 digits. P.S.: The alternative would be to allow and ignore leading zeros. If you think that would be 'the right thing to do'[tm] please let me know why.