php-7.1

PHP7.1 json_encode() Float Issue

我只是一个虾纸丫 提交于 2019-11-27 11:11:28
This isn't a question as it is more of a be aware. I updated an application that uses json_encode() to PHP7.1.1 and I was seeing an issue with floats being changed to sometimes extend out 17 digits. According to documentation, PHP 7.1.x started to use serialize_precision instead of precision when encoding double values. I'm guessing this caused an example value of 472.185 to become 472.18500000000006 after that value went through json_encode() . Since my discovery, I have reverted back to PHP 7.0.16 and I no longer have the issue with json_encode() . I also tried to update to PHP 7.1.2 before

How do I make openssl_encrypt pad the input to the required block size?

為{幸葍}努か 提交于 2019-11-27 07:14:59
问题 My code works if I manually pad my string to the length of 32. My question is: Is there a way to make the openSSL pad the data, or do I always have to do it for it? Working: openssl_encrypt ("my baba is over the ocean1111111", 'AES-256-CBC', $MY_SECRET_KEY,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING,$MY_IV); Not working: openssl_encrypt ("my baba is over the ocean", 'AES-256-CBC', $MY_SECRET_KEY,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING,$MY_IV); I solve this currently by self padding: $pad = 32 -

Codeigniter 3 Session not working With PHP 7.1.4

亡梦爱人 提交于 2019-11-27 04:47:10
问题 I have an application built with Codeigniter 3 HMVC .The application was working fine on PHP 5.6 version, But after upgrading my PHP version to 7.1.4 I was not able to log in into my application. After a complete checkup I found that session is not setting at all. I role back to PHP 5.6 and session was working fine again while switching to PHP 7.1.4 bring the "session not working" issue back. I tried altering some config value like cookie prefix and cookie save name etc, nothing seems to fix

PHP7.1 mcrypt alternative

泄露秘密 提交于 2019-11-26 20:56:38
Mcrypt function has been deprecated as of PHP 7.1.0. My deprecated string encode / decode functions: $key: secret key $str: string $encoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $str, MCRYPT_MODE_CBC, md5(md5($key)))); $decoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($str), MCRYPT_MODE_CBC, md5(md5($key))), "\0"); Can you suggest some alternatives? You should use openssl_encrypt instead. Regards! Consider using defuse or RNCryptor , they provide a complete solution, are being maintained and is correct. For MCRYPT_RIJNDAEL_256 I posted a

PHP7.1 json_encode() Float Issue

[亡魂溺海] 提交于 2019-11-26 15:23:13
问题 This isn't a question as it is more of a be aware. I updated an application that uses json_encode() to PHP7.1.1 and I was seeing an issue with floats being changed to sometimes extend out 17 digits. According to documentation, PHP 7.1.x started to use serialize_precision instead of precision when encoding double values. I'm guessing this caused an example value of 472.185 to become 472.18500000000006 after that value went through json_encode() . Since my discovery, I have reverted back to PHP

PHP7.1 mcrypt alternative

空扰寡人 提交于 2019-11-26 07:46:22
问题 Mcrypt function has been deprecated as of PHP 7.1.0. My deprecated string encode / decode functions: $key: secret key $str: string $encoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $str, MCRYPT_MODE_CBC, md5(md5($key)))); $decoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($str), MCRYPT_MODE_CBC, md5(md5($key))), \"\\0\"); Can you suggest some alternatives? 回答1: You should use openssl_encrypt instead. 回答2: Consider using defuse or RNCryptor,