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

Iterating over TransactionList returns null instead of object when retrieved from Invoice #30

Closed
epixa opened this issue Mar 20, 2012 · 9 comments
Labels
V2 V2 Client

Comments

@epixa
Copy link

epixa commented Mar 20, 2012

When you retrieve an Invoice with Recurly_Invoice::get(), the resulting object has a TransactionList named "transactions". Despite the TransactionList clearly having Transaction objects, if you attempt to iterate over that list, null is returned for each transaction rather than the transaction object itself.

Code to recreate the issue (use your own invoice id):

<?php
// include recurly, set $invoiceNumber
$invoice = Recurly_Invoice::get($invoiceNumber);
foreach ($invoice->transactions as $transaction) {
    echo gettype($transaction);
}
// assuming 1 transaction
// expected result: object
// actual result: NULL

The commit that directly causes this bug is 6895c7f

@kainosnoema
Copy link

@epixa this is now fixed in the latest version (commit: 1bb87de).

@epixa
Copy link
Author

epixa commented Jun 7, 2012

Great to hear! Thanks.

@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
@crystinutzaa
Copy link

@bhelx This issue was just re-introduced.

I can confirm that it worked just fine till yesterday around:[2022-08-09 02:26 pm] it started to happen.

foreach ($invoice->transactions as $transaction) {
    echo gettype($transaction);
}
// assuming 1 transaction
// expected result: object
// actual result: NULL

@bhelx
Copy link
Contributor

bhelx commented Aug 10, 2022

Wow, a bug lurking in hiding for 10+ years! I'm no longer at Recurly. I think the best person to notify would be @douglasmiller .

@douglasmiller
Copy link
Contributor

Thank you for letting us know about this, @crystinutzaa. Could you share what version of the php client you are using?

I have an idea what might be causing this to re-appear, but would like to confirm.

@douglasmiller douglasmiller reopened this Aug 11, 2022
@crystinutzaa
Copy link

Hey @douglasmiller
We use "recurly/recurly-client": "2.12.*",

@douglasmiller
Copy link
Contributor

douglasmiller commented Aug 11, 2022

@crystinutzaa, I cannot reproduce the issue with the given code using the latest version of the 2.12.x client.

However, I've seen similar issues in the dotnet client. This has something to do with a change to how we render empty elements so I will get that change reverted until we can discover what the root cause of this client issue is.

I'll keep you posted

@douglasmiller
Copy link
Contributor

@crystinutzaa, we have reverted the change in the API and this should be fixed for you. Could you please confirm?

@crystinutzaa
Copy link

@douglasmiller confirmed! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

No branches or pull requests

5 participants