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

DNSRecord toArray missing data array #52

Open
xorinzor opened this issue Aug 6, 2023 · 4 comments
Open

DNSRecord toArray missing data array #52

xorinzor opened this issue Aug 6, 2023 · 4 comments

Comments

@xorinzor
Copy link

xorinzor commented Aug 6, 2023

It seems that the toArray function of DNSRecord doesn't call toArray on the data field (if it exists). Instead turning it into a string of text.

https://github.com/remotelyliving/php-dns/blob/711697608616931c9ec94624cb8984355b73102e/src/Entities/DNSRecord.php#L108C58-L108C58

Is this intended?

@xorinzor
Copy link
Author

xorinzor commented Aug 6, 2023

same seems to also happen for the IpAddress field

@remotelyliving
Copy link
Owner

Hi there! Thanks for reporting this. Could you please provide a sample domain and query this is happening for or is it all of them?

@remotelyliving
Copy link
Owner

Oh, nvm. I misunderstood what you are saying. You want the original IPAddress or Data object in the array for toArray(). I do see that as a flaw come to think of it. It's premature formatting. I would suggest using the getIPAddress() or getData() methods instead or feel free to apply the decorator pattern the DNSRecord object with your own and format toArray() as you like it. I can update this in a breaking change release sometime in the future. I'll leave this open until then.

@xorinzor
Copy link
Author

Sure no worries, it's easy to work around too. There's something to say for both ways the toArray() method could work, so I'm not really sure what would be the "proper" way of handling this either.

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

No branches or pull requests

2 participants