Skip to content

Commit

Permalink
fix the Binary operation "*" between string and 256 results in an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
huankong233 committed Apr 12, 2024
1 parent b8dc591 commit a4d013d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ private static function parse(string $url)
$ipv4_address = $matches[3];
$ipParts = explode('.', $ipv4_address);
if (count($ipParts) === 4) {
$part7 = base_convert((string)(($ipParts[0] * 256) + $ipParts[1]), 10, 16);
$part8 = base_convert((string)(($ipParts[2] * 256) + $ipParts[3]), 10, 16);
$part7 = base_convert((string)(((int)$ipParts[0] * 256) + (int)$ipParts[1]), 10, 16);
$part8 = base_convert((string)(((int)$ipParts[2] * 256) + (int)$ipParts[3]), 10, 16);

$prefix = $matches[1] . '[' . $matches[2] . ':' . $part7 . ':' . $part8 . ']';
$url = $matches[4];
Expand Down

0 comments on commit a4d013d

Please sign in to comment.