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

Some CODA files are having lines with 130 characters instead of 128. #19

Open
sbichara opened this issue Jan 3, 2021 · 3 comments
Open

Comments

@sbichara
Copy link

sbichara commented Jan 3, 2021

Hi,
First of all many thx for this useful package.

I noticed that the ING CODA files are having lines with 130 characters instead of 128 which then throws a fatal exception in the parser.
By "trimming" the line, the issue is solved (I added the trim in the function Parse of the class LinesParser.php).

foreach($codaLines as $line) {
			if (!empty($line)) {
				/** @var LineInterface|null $lineObject */
				$lineObject = null;
				$line = trim($line);

Thank you.

Sélim

@kouinkouin
Copy link

kouinkouin commented Jan 3, 2021

Hi,
Not better to put the trim before the if (!empty($line)) {, to avoid to treat an empty line?

And, what happens if the "trimmed" line has 127 char (because the 128th was a space)? (i don't know if the last char can be a space...)

@sbichara
Copy link
Author

sbichara commented Jan 3, 2021

Hi,
I agree with both of your comments.
In the end you need to ensure that the line has the correct length after the trim and see whether it's relevant to process it or not.

@wimverstuyf
Copy link
Owner

Hi Sélim,

Strange that the ING-file does not have 128 characters. The 2 extra character are only white spaces?
Adding a trim would be a good solution. The last character (character 128) should always be a number so no need to add a safeguard against trimming this value.

Can you create a PR + unittest? Then I'll take a look at it.

Wim

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