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

Parser: TXT record with number as value throws exception #89

Closed
lorenzbausch opened this issue Dec 29, 2020 · 3 comments
Closed

Parser: TXT record with number as value throws exception #89

lorenzbausch opened this issue Dec 29, 2020 · 3 comments

Comments

@lorenzbausch
Copy link

Reproduce:

<?php

require_once 'vendor/autoload.php';

$zone = Badcow\DNS\Parser\Parser::parse('foo.tld.', 'foo.	14400	IN	TXT	3600');

stack trace:

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Badcow\DNS\Classes::isValid() must be of the type string, null given, called in /path/to/project/vendor/badcow/dns/lib/Parser/Parser.php on line 365 and defined in /path/to/project/vendor/badcow/dns/lib/Classes.php:53
Stack trace:
#0 /path/to/project/vendor/badcow/dns/lib/Parser/Parser.php(365): Badcow\DNS\Classes::isValid(NULL)
#1 /path/to/project/vendor/badcow/dns/lib/Parser/Parser.php(415): Badcow\DNS\Parser\Parser->isClass(Object(Badcow\DNS\Parser\ResourceRecordIterator), 'TTL')
#2 /path/to/project/vendor/badcow/dns/lib/Parser/Parser.php(342): Badcow\DNS\Parser\Parser->isTTL(Object(Badcow\DNS\Parser\ResourceRecordIterator))
#3 /path/to/project/vendor/badcow/dns/lib/Parser/Parser.php(170): Badcow\DNS\Parser\Parser->isResourceName(Object(Badcow\DNS\Parser\ResourceRecordIterator))
#4 /path/to/project/vendor/badcow/dns/lib/Parser/P in /path/to/project/vendor/badcow/dns/lib/Classes.php on line 53

(Might be related to #88 ?)

Thank you for maintaining this library, it's a real 💎!

@samuelwilliams
Copy link
Contributor

@lorenzbausch I think this is a different issue to #88, but they still are related. These are very niche edge case behaviours because I have never come across a TXT string that wasn't encapsulated in quotes.

samuelwilliams added a commit that referenced this issue Jan 9, 2021
samuelwilliams added a commit that referenced this issue Jan 9, 2021
@samuelwilliams
Copy link
Contributor

Fixed with PR #93

@lorenzbausch
Copy link
Author

@samuelwilliams thank you for fixing this 💪 In fact I encountered this issue when parsing zone files with user supplied content.

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