Comments (7)
I suspect the issue is in the xml2array method, but need to explore a little further to see what is really happening. Between 7.1 and 7.2, this method behaves very differently. Whether it is this method, or the data passed to it, I don't know.
from omnipay-authorizenet.
Is this about the changes to operator precedence? This is the line now:
$result = (string)$this->data['messages'][0]['resultCode'];
TBH I'm not sure why the value is cast to a string, since you can't cast an array to a string anyway. If you take out the (string)
completely, does it work for you? I've not got PHP7.2 handy to try it on, though we could enable on travis.
Edit: Just noticed I have got 7.2 available to install. Just doing that now.
from omnipay-authorizenet.
Not sure where the problem is exactly, but it seems to be the way the XML is parsed. This is what the response looks like in 7.1:
array(2) {
["messages"]=>
array(1) {
[0]=>
array(2) {
["resultCode"]=>
string(2) "Ok"
["message"]=>
array(1) {
[0]=>
array(2) {
["code"]=>
string(6) "I00001"
["text"]=>
string(11) "Successful."
}
}
}
}
Then in 7.2 the response looks like this:
array(2) {
["messages"]=>
array(1) {
[0]=>
array(2) {
["resultCode"]=>
array(1) {
[0]=>
array(0) {
}
}
["message"]=>
array(1) {
[0]=>
array(2) {
["code"]=>
array(1) {
[0]=>
array(0) {
}
}
["text"]=>
array(1) {
[0]=>
array(0) {
}
}
}
}
}
}
Note all the string nodes have tuned into empty arrays :-/
from omnipay-authorizenet.
Good find, I'll try poking around as well.
from omnipay-authorizenet.
I won't have time to look until I get home (about 8 hours). I cannot find anything on SO or the docs that indicate SimpleXML has changed in 7.2, except for a few bug fixes. So that may point more towards where the XML is parsed. But I may be completely off there.
from omnipay-authorizenet.
There is a PR to play with here. It uses the much simpler json_decode of a json_encode to convert the parsed XML object to an array. This does change the structure of the resulting array slightly. It is failing all travis tests on 7.2 due to deprecated code in phpunit (3.9). I'm sure there will be a way to disable some cs code checks for PHP 7.2 only, or perhaps the travis config is not pointing phpcs at the correct directory to scan - not sure.
from omnipay-authorizenet.
A fix has been in place since January 2017 (for version 3.0.0) that changes the way the XML is decoded to an array. That was probably merged in accidentally, but it does not seem to have raised any issues, so I'm going to close this issue.
If I've overlooked anything here, please reopen or raise a new issue if there are other subsequent side-effects. The JSON encode/decode technique used to convert the XML to an array does have its limits (e.g. not properly handling attributes), but the XML supplied by this gateway does not seem to hit it.
from omnipay-authorizenet.
Related Issues (20)
- Add support for retail data to AIMAuthorizeRequest HOT 3
- Add support for track data to AIMAuthorizeRequest HOT 1
- Add Line Items HOT 2
- Omnipay 3.0 support? HOT 3
- Laravel 5.6 failed HOT 5
- AIMRequest simplexml_load_string chokes HOT 6
- Error on refund
- Error on refund HOT 6
- Add customer info to transaction. HOT 6
- SIM complete purchase response HOT 2
- InvalidArgumentException: Invalid header syntax HOT 1
- Support HMAC SHA-512 hash rather than md5 (urgent) HOT 19
- Invalid paths for AIM query messages HOT 10
- Deprecated API HOT 4
- Need of Full example with all options (optional options also) HOT 1
- Unable to make few partial refunds for transaction
- Show example of passing CreditCard with auth.net HOT 2
- Sale Tax HOT 1
- Declined transactions being passed as successful
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omnipay-authorizenet.