-
Notifications
You must be signed in to change notification settings - Fork 73
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
Problem with $xero->Payments #7
Comments
Hi I've just starting using this and I get a Segmentation fault (i'm test using the command line) when adding a new payment but both adding a new Contact and Invoice and listing my Accounts all work fine. I've also emailed xero to see if its anything at there end Note the xero status for these are 400 but i can't see anything wrong. Nick |
I seem to be having the same issue, what I have noticed is that on my development machine which runs windows 7 it works fine, but on our production machine which runs Debian it is having issues when it reaches that line $xero_response = curl_exec($ch). |
I've got mine to work by using fsocket for the put message if you email me I can send you my xero.php. nickteagle (at) gmail.com. I'm also tried installing the latest version of php and curl and I still have the error so i'm going to raise a bug on curl and see if that helps. Nick |
I've commited Nick's fix for this here: https://github.com/dmytton/PHP-Xero/commit/054c45906aa1d9d0b70d49ed133081464810436a |
What's happening is that the memory-mapped file is closed before curl has a chance to read it - it's a problem with the xero library, not curl. Here's a patch: diff --git a/xero.php b/xero.php
index 3afa43d..1215780 100644
--- a/xero.php
+++ b/xero.php
@@ -303,10 +303,13 @@ class Xero {
curl_setopt($ch, CURLOPT_INFILE, $fh);
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($xml));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- fclose($fh);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xero_response = curl_exec($ch);
+ if (isset($fh))
+ {
+ fclose($fh);
+ }
$xero_xml = simplexml_load_string( $xero_response );
if (!$xero_xml) {
return $xero_response; I've opened a new pull request (#13) with this change as well. |
Thanks for posting this fix. Much obliged. |
All methods seem to work fine except $xero->Payments
The screen just goes blank after calling the following method with print_r. I've PHP error values set to show all & it's still blank.
$payment_result = $xero->Payments( $new_payment );
print_r($payment_result);
Any ideas?
The text was updated successfully, but these errors were encountered: