Skip to content

Commit

Permalink
Support PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Dec 3, 2020
1 parent 0bbb00b commit 1c30373
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,25 @@ matrix:
- php: "7.2"
os: linux
env: CHECK_MBSTRING=0
- php: "7.3"
os: linux
env: CHECK_MBSTRING=0
- php: "7.4"
os: linux
env: CHECK_MBSTRING=0
- php: "8.0"
os: linux
env: CHECK_MBSTRING=0
- php: "nightly"
os: linux
env: CHECK_MBSTRING=0
- php: "master"
os: linux
env: CHECK_MBSTRING=0
- php: "hhvm"
os: linux
env: CHECK_MBSTRING=1
allow_failures:
- php: "8.0"
- php: "nightly"
- php: "master"
- php: "hhvm"

install:
- composer self-update
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"require": {
"php": "^7",
"php": "^7|^8",
"paragonie/constant_time_encoding": "^2",
"paragonie/sodium_compat": "^1.6"
},
Expand All @@ -27,8 +27,8 @@
}
},
"require-dev": {
"phpunit/phpunit": "^6|^7",
"vimeo/psalm": "^1"
"phpunit/phpunit": "^6|^7|^8|^9",
"vimeo/psalm": "^3|^4"
},
"config": {
"preferred-install": "dist",
Expand Down
5 changes: 4 additions & 1 deletion src/HiddenString.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ public function __destruct()
} catch (\Throwable $ex) {
}
}
if (is_null($this->internalStringValue)) {
return;
}

// Last-ditch attempt to wipe existing values if libsodium is not
// available. Don't rely on this.
$zero = \str_repeat("\0", (int) Binary::safeStrlen($this->internalStringValue));
$zero = \str_repeat("\0", Binary::safeStrlen($this->internalStringValue));
$this->internalStringValue = $this->internalStringValue ^ (
$zero ^ $this->internalStringValue
);
Expand Down

0 comments on commit 1c30373

Please sign in to comment.