Skip to content

Fix the IPv6 protocol type value 'ipv46' - #11

Open
tomsommer wants to merge 1 commit into
ArrayAccess:mainfrom
tomsommer:fix-ipv6-protocol-type
Open

tomsommer wants to merge 1 commit into
ArrayAccess:mainfrom
tomsommer:fix-ipv6-protocol-type

Conversation

@tomsommer

Copy link
Copy Markdown

RdapClientInterface::IPV6 had the value 'ipv46', which looks like a typo next to IPV4 = 'ipv4'. It is now 'ipv6'.

The value is also what guessType() returns and what request()/getProtocol() accept, so callers might pass the string 'ipv46' directly. To avoid breaking them, 'ipv46' stays as an alias:

Input Before After
Client::IPV6 'ipv46' 'ipv6'
guessType('2a00:1450:4001::1') ['ipv46', ...] ['ipv6', ...]
getProtocol('ipv6') UnsupportedProtocolException IPv6Protocol
getProtocol('ipv46') / request($ip, 'ipv46') IPv6Protocol IPv6Protocol (same instance as 'ipv6')
hasProtocol('ipv46') true true

The only visible change is the value of the constant and of guessType()[0]. Code comparing either against the literal 'ipv46' would need updating; code using Client::IPV6 is unaffected.

phpcs and phpstan pass (also with phpVersion: 80100). Checked live with ipv6() and request($ip, 'ipv46').

RdapClientInterface::IPV6 is now 'ipv6'. 'ipv46' is kept as an alias
in hasProtocol() and getProtocol(), so code passing the old string
keeps working.
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.

1 participant