asgrim / ofxparser

:moneybag: OFX File Parser
MIT License
108 stars 102 forks source link

xmlParseEntityRef: no name #53

Closed czmarcos closed 5 years ago

czmarcos commented 5 years ago

I am getting the following error "xmlParseEntityRef: no name" when trying to parse an ofx file submitted from a file upload form.

I searched over the internet and it looks like the problem is related to the stray ‘&’ (ampersand character) somewhere in the file. How can I come over this? They suggest to remove or encode the ampersand, but the file is being uploaded from an upload form.

$file_path = $_FILES["fileUpload"]["tmp_name"];

$ofxParser = new \OfxParser\Parser();
$ofx = $ofxParser->loadFromFile($file_path);

$bankAccount = reset($ofx->bankAccounts);

// Get the statement transactions for the account
$transactions = $bankAccount->statement->transactions;

var_dump($startDate, $endDate, $transactions);
asgrim commented 5 years ago

There is a PR to fix this in asgrim/ofxparser#51 but there are no tests provided.

czmarcos commented 5 years ago

@asgrim, thanks! this fix worked!

asgrim commented 5 years ago

Glad it worked, please leave the issue open though as it's still a bug :grin: