Skip to content

Commit

Permalink
Fix incorrect check error occurred while converting IP address to bit…
Browse files Browse the repository at this point in the history
…s representation in PHP 8.0+
  • Loading branch information
vjik committed Aug 2, 2024
1 parent 6242c91 commit d85625a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## 1.0.2 under development

- no changes in this release.
- Bug #59: Fix incorrect check error occurred while converting IP address to bits representation in PHP 8.0+ (@vjik)

## 1.0.1 January 27, 2022

- Bug #40: Fix return type for callback of `set_error_handler()` function (devanych)
- Bug #40: Fix return type for callback of `set_error_handler()` function (@devanych)

## 1.0.0 March 04, 2021

Expand Down
2 changes: 1 addition & 1 deletion src/IpHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static function ip2bin(string $ip): string
$result = '';
for ($i = 0, $iMax = strlen($ipBinary); $i < $iMax; $i += 4) {
$data = substr($ipBinary, $i, 4);
if (!is_string($data)) {
if (empty($data)) {
throw new RuntimeException('An error occurred while converting IP address to bits representation.');
}
/** @psalm-suppress MixedArgument */
Expand Down

0 comments on commit d85625a

Please sign in to comment.