Skip to content

Commit

Permalink
1.5.x - Proposed fix to work around sektioneins/suhosin#92
Browse files Browse the repository at this point in the history
See #39
  • Loading branch information
paragonie-security committed Jul 29, 2016
1 parent fbdc796 commit 452f19e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Asymmetric/Crypto.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static function seal(
'Argument 2: Expected an instance of EncryptionPublicKey'
);
}
if (!function_exists('\\Sodium\\crypto_box_seal')) {
if (!\is_callable('\\Sodium\\crypto_box_seal')) {
throw new CryptoException\CannotPerformOperation(
'crypto_box_seal is not available'
);
Expand Down Expand Up @@ -247,7 +247,7 @@ public static function unseal(
if (!$raw) {
$source = \Sodium\hex2bin($source);
}
if (!function_exists('\\Sodium\\crypto_box_seal_open')) {
if (!\is_callable('\\Sodium\\crypto_box_seal_open')) {
throw new CryptoException\CannotPerformOperation(
'crypto_box_seal_open is not available, please update/reinstall libsodium'
);
Expand Down
4 changes: 2 additions & 2 deletions src/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static function safeStrlen($str)
{
static $exists = null;
if ($exists === null) {
$exists = \function_exists('mb_strlen');
$exists = \is_callable('mb_strlen');
}
if (!\is_string($str)) {
throw new Alerts\InvalidType(
Expand Down Expand Up @@ -125,7 +125,7 @@ public static function safeSubstr($str, $start, $length = null)
{
static $exists = null;
if ($exists === null) {
$exists = \function_exists('mb_substr');
$exists = \is_callable('mb_substr');
}
if ($exists) {
// mb_substr($str, 0, NULL, '8bit') returns an empty string on PHP
Expand Down

0 comments on commit 452f19e

Please sign in to comment.