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

Prevent API undefined property: stdClass:$server error when firewall has attached tags #83

Merged

Conversation

geisi
Copy link
Contributor

@geisi geisi commented Oct 13, 2021

Hello this is my first PR in this project:

Before this PR following error occurred when you query a firewall with an attached label:

Undefined property: stdClass::$server thrown in hetzner-cloud-php-sdk/src/Models/Firewalls/Firewall.php:125

I reproduced this error by extending the firewall.json and firewalls.json fixtures with tag objects.

This error happens because the firewall model assumes that only server resources can be attached to a firewall.

This PR checks every firewall applied service and only adds it to the appliedTo array when it is a server object. This is only a workaround around this problem. In the future these tags(and their corresponding servers) should also be applied to the appliedTo array but this needs some bigger refactoring in the firewall model code. So this is only a quick fix.

Thank you for your hard work!

@LKaemmerling LKaemmerling merged commit 4454675 into LKDevelopment:master Oct 18, 2022
@LKaemmerling
Copy link
Collaborator

Good catch! Thank you!

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

Successfully merging this pull request may close these issues.

2 participants