-
Notifications
You must be signed in to change notification settings - Fork 339
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
Fix for php 8.1 compatibility #330
base: master
Are you sure you want to change the base?
Conversation
QuickBooks/Driver/Sql/Mysqli.php
Outdated
@@ -436,7 +436,7 @@ protected function _escape($str) | |||
$str = ''; | |||
} | |||
|
|||
return $this->_conn->real_escape_string($str); | |||
return $this->_conn->real_escape_string($str ?? ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: Please do this place and similar places in this PR, where ??
is used.
Usage of the null coalescing operator (??
) on the PHP < 7.0 would result in a syntax error.
Please adjust the code to also work on PHP 5.x (according to composer.json
this library supports PHP 5.x).
For this particular place maybe it's better to return NULL
, when $str === null
, but since there are no automated tests, this might break things :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used isset() ? : instead...
Please also remove |
Done. |
Looks perfect to me. @xtremevision , Have you tested these changes in a production environment (e.g. in a project that runs on PHP 8.1+, where this library is used)? |
Tbh I can't remember. A lot of time has passed since I placed this PR. I can't remember if I used it and/or where. I'll check. |
QuickBooks/XML.php
Outdated
@@ -433,8 +433,8 @@ static public function decode($str, $for_qbxml = true) | |||
'"' => '"', | |||
'&' => '&', // Make sure that this is *the last* transformation to run, otherwise we end up double-un-encoding things | |||
); | |||
|
|||
return str_replace(array_keys($transform), array_values($transform), $str); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the last change. Please remove this trailing space.
I hope that once this PR is merged. The library would be work on PHP 8.1+. For people using this library, that should be a big relief. If possible, consider switching to the official QuickBooks API client for PHP: https://github.com/intuit/QuickBooks-V3-PHP-SDK . |
Done. Removed trailing space. |
You've removed the wrong trailing space. There should be one empty file at the end of each file. I was talking about the empty line above the |
Sorry, try now. |
Great. Thank you @xtremevision . |
Many people probably would if this SDK supported QB Desktop. |
Fixed array notation curly brackets