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

Fix for php 8.1 compatibility #330

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,5 @@ pip-log.txt

# Mac crap
.DS_Store

*.code-workspace
2 changes: 1 addition & 1 deletion QuickBooks/Cast.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static public function cast($type_or_action, $field, $value, $use_abbrevs = true
$dh = opendir(dirname(__FILE__) . '/QBXML/Schema/Object');
while (false !== ($file = readdir($dh)))
{
if ($file{0} == '.' or substr($file, -6, 6) != 'Rq.php')
if ($file[0] == '.' or substr($file, -6, 6) != 'Rq.php')
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion QuickBooks/Driver/Sql/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ protected function _escape($str)
$str = '';
}

return $this->_conn->real_escape_string($str);
return $this->_conn->real_escape_string($str ?? '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion QuickBooks/MerchantService/CheckingAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct($routing, $account, $info, $type, $first_name, $last

$phone = trim(str_replace(array('(', ')', '+', ' ', '.', '-'), '', $phone));
if (strlen($phone) == 11 and
$phone{0} == '1')
$phone[0] == '1')
{
$phone = substr($phone, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion QuickBooks/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static public function mask($message)
// It's an XML tag
$contents = QuickBooks_Utilities::_extractTagContents(trim($key, '<> '), $message);

$masked = str_repeat('x', min(strlen($contents), 12)) . substr($contents, 12);
$masked = str_repeat('x', min(strlen($contents ?? ''), 12)) . substr($contents ?? '', 12);

$message = str_replace($key . $contents . '</' . trim($key, '<> ') . '>', $key . $masked . '</' . trim($key, '<> ') . '>', $message);
}
Expand Down
2 changes: 1 addition & 1 deletion QuickBooks/WebConnector/Handlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public function authenticate($obj)
$customauth_wait_before_next_update = null;
$customauth_min_run_every_n_seconds = null;

if (is_array($override_dsn) or strlen($override_dsn)) // Custom autj
if (is_array($override_dsn) or strlen($override_dsn ?? '')) // Custom autj
{
//if ($auth->authenticate($obj->strUserName, $obj->strPassword, $customauth_company_file, $customauth_wait_before_next_update, $customauth_min_run_every_n_seconds) and

Expand Down
2 changes: 1 addition & 1 deletion QuickBooks/XML.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ static public function decode($str, $for_qbxml = true)
'&amp;' => '&', // 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);
return str_replace(array_keys($transform), array_values($transform), $str ?? '');
}
}

2 changes: 1 addition & 1 deletion QuickBooks/XML/Backend/Builtin.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ protected function _parseHelper($xml, &$Root, &$errnum, &$errmsg, $indent = 0)
$Node->addAttribute($key, $value);
}

if (false !== strpos($payload, '<'))
if (false !== strpos($payload ?? '', '<'))
{
// The tag contains child tags

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "consolibyte/quickbooks",
"name": "xtremevision/quickbooks",
"type": "library",
"description": "QuickBooks DevKit with support for Intuit Anywhere, Intuit Partner Platform, Web Connector, QuickBooks Merchant Services, and more.",
"keywords": ["quickbooks","intuit","intuit anywhere","intuit partner platform","quickbooks web connector","qbxml","intuit data services","quickbooks merchant services","intuit merchant services","web connector"],
Expand Down