Skip to content

Commit 1f4c7fc

Browse files
committed
Merge pull request #4 from rdlowrey/rdlowrey-ctype-fix
Remove ext/ctype dependency
2 parents 5a97880 + 7c9d5c4 commit 1f4c7fc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/LibDNS/Records/Types/IPv4Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function setOctets(array $octets)
8686
}
8787

8888
foreach ($octets as &$octet) {
89-
if (!ctype_digit((string) $octet) || $octet < 0x00 || $octet > 0xff) {
89+
if (strspn((string)$octet, "0123456789") !== strlen($octet) || $octet < 0x00 || $octet > 0xff) {
9090
throw new \UnexpectedValueException('Octet list is not a valid IPv4 address: invalid octet value ' . $octet);
9191
}
9292

src/LibDNS/Records/Types/IPv6Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function setShorts(array $shorts)
151151
}
152152

153153
foreach ($shorts as &$short) {
154-
if (!ctype_digit((string) $short) || $short < 0x0000 || $short > 0xffff) {
154+
if (strspn((string)$short, "0123456789") !== strlen($short) || $short < 0x0000 || $short > 0xffff) {
155155
throw new \UnexpectedValueException('Short list is not a valid IPv6 address: invalid short value ' . $short);
156156
}
157157

0 commit comments

Comments
 (0)