From 452f19ee8391c8d272635254a4dabbe702327d2a Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Fri, 29 Jul 2016 12:20:38 -0400 Subject: [PATCH] 1.5.x - Proposed fix to work around https://github.com/stefanesser/suhosin/issues/92 See #39 --- src/Asymmetric/Crypto.php | 4 ++-- src/Util.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Asymmetric/Crypto.php b/src/Asymmetric/Crypto.php index 47adc91..cc5dd27 100644 --- a/src/Asymmetric/Crypto.php +++ b/src/Asymmetric/Crypto.php @@ -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' ); @@ -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' ); diff --git a/src/Util.php b/src/Util.php index 01bb215..05515f9 100644 --- a/src/Util.php +++ b/src/Util.php @@ -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( @@ -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