dcid / doh-php-client

DoH (DNS over HTTPS) PHP Client
GNU General Public License v3.0
52 stars 7 forks source link

php errors #3

Open jpgpi250 opened 4 years ago

jpgpi250 commented 4 years ago

when running

php /home/pi/DOH/doh-php-client.php doh.libredns.gr doh.libredns.gr

I'm using this to check if a doh server at least can resolve it's own name, than marking it as an operational doh server.

a lot of php errors occur (example) PHP Notice: Uninitialized string offset: 188 in /home/pi/DOH/doh-php-client.php on line 42

this is probably due to a bad response from doh.libredns.gr, I wonder if you could catch the bad response, thus avoiding the error messages.

Thanks.

ebal commented 4 years ago

The issue is with dns alias (CNAME RR)

eg.

$ php doh-php-client.php cloudflare www.github.com A 

...
PHP Notice:  Uninitialized string offset: 191 in /opt/dnl/github/dcid/doh-php-client.git/doh-php-client.php on line 42
PHP Notice:  Uninitialized string offset: 192 in /opt/dnl/github/dcid/doh-php-client.git/doh-php-client.php on line 42

or

$ php doh-php-client.php google www.github.com A
...
PHP Notice:  Uninitialized string offset: 192 in /opt/dnl/github/dcid/doh-php-client.git/doh-php-client.php on line 42
PHP Notice:  Uninitialized string offset: 193 in /opt/dnl/github/dcid/doh-php-client.git/doh-php-client.php on line 45
$ host www.github.com
www.github.com is an alias for github.com.