Problem with mbstring.internal_encoding, mcrypt and php-fpm

[email protected] (Condor)
Newsgroups php.general
Message-ID <[email protected]>
Hello,

from two days I have strange problem with this param 
mbstring.internal_encoding on nginx and php-fpm.
I use php version 5.4.20 and when I setting mbstring.internal_encoding I 
have a problem with mcrypt.

NOTICE: PHP message: PHP Warning:  mcrypt_generic_init(): Iv size 
incorrect; supplied length: 12, needed: 8 in file.php

I setup php.ini file:

zend.multibyte = On
default_mimetype = "text/html"
default_charset = "UTF-8"
mbstring.internal_encoding = UTF-8



and here is function:

  85         private function decrypt($blob)
  86         {
  87                 $deckey = $_SESSION['key'];
  88                 $realkey = sha1($deckey, true);
  89                 $rawblob = hex2bin($blob); /* binary blob */
  90                 $td = mcrypt_module_open($this->CIPHER, "", 
MCRYPT_MODE_CFB, "");
  91                 $iv = mb_substr($rawblob, 0, 
mcrypt_enc_get_iv_size($td)); /* IV */
  92                 if (mb_strlen($iv) < mcrypt_enc_get_iv_size($td)) 
return FALSE;
  93                 $ct = mb_substr($rawblob, 
mcrypt_enc_get_iv_size($td)); /* CipherText */
  94    --->         mcrypt_generic_init($td, $realkey, $iv);
  95                 $unblob = mdecrypt_generic($td, $ct);
  96                 mcrypt_generic_deinit($td);
  97                 $pt = mb_substr($unblob, 20);
  98                 $check = mb_substr($unblob, 0, 20);
  99                 if ($check != sha1($pt, true))
100                 {
101                         return FALSE;
102                 } else {
103                         return $pt;
104                 }
105         }


The same code with the same config options is worked fine with apache 
httpd.

Any one can give me a little help ?
Thanks

Regards,
Hristo S.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.