kassner / log-parser

PHP Web Server Log Parser Library
Apache License 2.0
334 stars 64 forks source link

Fix ipv6 parsing edge cases #24

Closed Sophist-UK closed 7 years ago

Sophist-UK commented 7 years ago

IPV6 parsing fails with leading or trailing ::.

This PR tweaks the regex for IPv6 to handle leading and trailing :: and splits the regex for IP addresses into several parts for readability and maintainability.

Sophist-UK commented 7 years ago

This PR is ready for merge - sorry about the number of commits.

kassner commented 7 years ago

@Sophist-UK thanks for the contribution! I'll release a new tagged version quite soon, doing some adjustments on travis and coding standards.

Sophist-UK commented 7 years ago

No problem. My reasons are a little convoluted.

I used to run a wordpress site, accessible over IPv6. This web site runs using wordpress. I installed the wp-dashboard-log-monitor plugin. This plugin uses kasner/log-parser under the covers. I get occassions when the plugin doesn't work because the end two parts of the IPv6 address are zero so the IPv6 address ends in ::. So I fix it here, and it is included in the dashboard plugin and the errors stop.

🥇

kassner commented 7 years ago

@Sophist-UK 1.2.0 is released and includes this PR. Thanks again for your contribution!