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

Warning in recurly_resource.php @ line 113 #524

Closed
tomarnold2 opened this issue Jul 23, 2020 · 2 comments · Fixed by #525
Closed

Warning in recurly_resource.php @ line 113 #524

tomarnold2 opened this issue Jul 23, 2020 · 2 comments · Fixed by #525
Assignees
Labels
bug V3 v2019-10-10 Client

Comments

@tomarnold2
Copy link

tomarnold2 commented Jul 23, 2020

Hi, I'm receiving this warning in the recurly-client-php library (version 3.4.0):

"First parameter must either be an object or the name of an existing class in Recurly\RecurlyResource::Recurly{closure}() (line 113 of C:\xampp\apps\myapp\htdocs\vendor\recurly\recurly-client\lib\recurly\recurly_resource.php"

To Reproduce

  1. I submit billing info and receive back a valid token
  2. I then call $client->previewPurchase($some_data);
  3. Everything comes back fully populated, but an $item is coming back from Recurly as null and line 113 isn't expecting it
  4. Warning is displayed on the next page load
  5. User confirms the purchase and I then call $client->createPurchase($some_data);
  6. The subscription is created, webhooks fire, all appears to be fine with the exception of the warning

Expected behavior
No warning message to be given.

Your Environment
PHP Version 7.4.7
Recurly Lib 3.4.0
XAMPP locally (Windows 10)
Chrome version 84.0.4147.89

It's easy enough for me to suppress the error, but I thought you'd want to know (or, if I'm doing something wrong, I'd appreciate a heads-up what that is so I can fix my code).

Thank you,
Tom

P.S. I tried to get the data to format nicely but this editor is munging it. So I'm just pasting the json encoded below.

$some_data
{"currency":"USD","account":{"code":"uid-66","first_name":"Tom","last_name":"Tester","username":"tom@example.com","email":"tom@example.com","tax_exempt":false,"transaction_type":"moto","address":{"street1":"123 Easy Street","street2":"","city":"Seattle","region":"Washington","postal_code":"98101","country":"US"},"billing_info":{"token_id":"sdptyiFxxxxxxxxxxfKQAQ"}},"subscriptions":[{"plan_code":"my_plan_recur_12","quantity":1,"custom_fields":[{"name":"id","value":"54321"},{"name":"id_user","value":"66"},{"name":"sku_nid","value":"121212 \/ PREMIUM_RENEW_012"}]}],"transaction_type":"moto"}

@joannasese
Copy link
Contributor

Hi @tomarnold2. Thanks for reporting. We'll take a look and get back to you.

@douglasmiller
Copy link
Contributor

Hello again, @tomarnold2!

Thanks for bringing this to our attention. This is a legitimate warning and just didn't get noticed in our smoke tests because it was scrolling out of view :/

I've added the appropriate null check in the cast method and the warning is no longer raised. Once the linked PR is merged, this will go out in the next release of the client.

douglasmiller added a commit that referenced this issue Jul 31, 2020
# Changelog

## [Unreleased](https://github.com/recurly/recurly-client-php/tree/HEAD)

[Full Changelog](3.4.0...HEAD)

**Implemented enhancements:**

- Latest Changes for 2019-10-10 \(usage, measured units, etc\) [\#527](#527) ([bhelx](https://github.com/bhelx))

**Fixed bugs:**

- Warning in recurly\_resource.php @ line 113 [\#524](#524)

**Merged pull requests:**

- Null checking variable before calling property\_exists to prevent Warning [\#525](#525) ([douglasmiller](https://github.com/douglasmiller))
- Updates array syntax to modern format [\#521](#521) ([douglasmiller](https://github.com/douglasmiller))
- Mon Jul  6 14:54:15 UTC 2020 Upgrade API version v2019-10-10 [\#515](#515) ([douglasmiller](https://github.com/douglasmiller))
douglasmiller added a commit that referenced this issue Jul 31, 2020
[Full Changelog](3.4.0...HEAD)

**Implemented enhancements:**

- Latest Changes for 2019-10-10 \(usage, measured units, etc\) [\#527](#527) ([bhelx](https://github.com/bhelx))

**Fixed bugs:**

- Warning in recurly\_resource.php @ line 113 [\#524](#524)

**Merged pull requests:**

- Null checking variable before calling property\_exists to prevent Warning [\#525](#525) ([douglasmiller](https://github.com/douglasmiller))
- Updates array syntax to modern format [\#521](#521) ([douglasmiller](https://github.com/douglasmiller))
- Mon Jul  6 14:54:15 UTC 2020 Upgrade API version v2019-10-10 [\#515](#515) ([douglasmiller](https://github.com/douglasmiller))
@joannasese joannasese added the V3 v2019-10-10 Client label Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V3 v2019-10-10 Client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants