diff --git a/.gitignore b/.gitignore index c7b6d033..baae0238 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,5 @@ pip-log.txt # Mac crap .DS_Store + +*.code-workspace \ No newline at end of file diff --git a/QuickBooks/Cast.php b/QuickBooks/Cast.php index d58f5c11..f97d3818 100755 --- a/QuickBooks/Cast.php +++ b/QuickBooks/Cast.php @@ -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; } diff --git a/QuickBooks/Driver/Sql/Mysqli.php b/QuickBooks/Driver/Sql/Mysqli.php index fe856210..8cde5480 100644 --- a/QuickBooks/Driver/Sql/Mysqli.php +++ b/QuickBooks/Driver/Sql/Mysqli.php @@ -436,7 +436,7 @@ protected function _escape($str) $str = ''; } - return $this->_conn->real_escape_string($str); + return $this->_conn->real_escape_string(isset($str) ? $str : ''); } /** diff --git a/QuickBooks/MerchantService/CheckingAccount.php b/QuickBooks/MerchantService/CheckingAccount.php index ac0dd32d..7f7a6339 100644 --- a/QuickBooks/MerchantService/CheckingAccount.php +++ b/QuickBooks/MerchantService/CheckingAccount.php @@ -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); } diff --git a/QuickBooks/Utilities.php b/QuickBooks/Utilities.php index c90ece51..9bbdbcde 100755 --- a/QuickBooks/Utilities.php +++ b/QuickBooks/Utilities.php @@ -91,7 +91,8 @@ static public function mask($message) { // It's an XML tag $contents = QuickBooks_Utilities::_extractTagContents(trim($key, '<> '), $message); - + + $contents = isset($contents) ? $contents : ''; $masked = str_repeat('x', min(strlen($contents), 12)) . substr($contents, 12); $message = str_replace($key . $contents . ' ') . '>', $key . $masked . ' ') . '>', $message); diff --git a/QuickBooks/WebConnector/Handlers.php b/QuickBooks/WebConnector/Handlers.php index 3348875d..722ed901 100755 --- a/QuickBooks/WebConnector/Handlers.php +++ b/QuickBooks/WebConnector/Handlers.php @@ -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(isset($override_dsn) ? $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 diff --git a/QuickBooks/XML.php b/QuickBooks/XML.php index b58ec3c5..c3577056 100755 --- a/QuickBooks/XML.php +++ b/QuickBooks/XML.php @@ -433,8 +433,7 @@ 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); + + return str_replace(array_keys($transform), array_values($transform), isset($str) ? $str : ''); } } - diff --git a/QuickBooks/XML/Backend/Builtin.php b/QuickBooks/XML/Backend/Builtin.php index 76849412..d5ddb704 100644 --- a/QuickBooks/XML/Backend/Builtin.php +++ b/QuickBooks/XML/Backend/Builtin.php @@ -376,7 +376,7 @@ protected function _parseHelper($xml, &$Root, &$errnum, &$errmsg, $indent = 0) $Node->addAttribute($key, $value); } - if (false !== strpos($payload, '<')) + if (false !== strpos(isset($payload) ? $payload : '', '<')) { // The tag contains child tags