Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Function mcrypt_create_iv() is deprecated #14

Open
freyandhy opened this issue Apr 11, 2017 · 3 comments
Open

Function mcrypt_create_iv() is deprecated #14

freyandhy opened this issue Apr 11, 2017 · 3 comments

Comments

@freyandhy
Copy link

Deprecated: Function mcrypt_create_iv() is deprecated in /app/resources/library/facebook-sdk-v5/PseudoRandomString/McryptPseudoRandomStringGenerator.php on line 57

I got this error when use facebook php sdk v5 at PHP 7. any idea how to solve this issue ?

@sohaibilyas
Copy link
Owner

I also get this but only on latest PHP; 7+.

@kazim-shawon
Copy link

Unknown: Function mcrypt_create_iv() is deprecated in Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php on line 57

I also got same error on PHP 7.1 can anyone solve this yet?

@relliv
Copy link

relliv commented Jan 12, 2018

Solution is simple. If you are using PHP 7 or higher 'mcrypt_create_iv' is no longer supported in PHP 7. How to fix it? Look at below example.

My old code:

if (function_exists('mcrypt_create_iv')) $randomData = mcrypt_create_iv(20, MCRYPT_DEV_URANDOM);

and I need to make some changes like this:

if (function_exists('random_bytes')) $randomData = random_bytes(20);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants