[php-src] Issue #11772: openssl_encrypt returns false with PHP 8.2.8 but string with PHP 8.1.0

From: Date: Sun, 23 Jul 2023 02:10:14 +0000
Subject: [php-src] Issue #11772: openssl_encrypt returns false with PHP 8.2.8 but string with PHP 8.1.0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245017@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11772 Author: RobertEcker ### Description The following code: ```php function test($string) { $key = "\x00\x00\x00\x00\x00\x00\x00\x00"; $key[0] = chr(ord($string[0]) & 254); $key[1] = chr((ord($string[0]) << 7) | (ord($string[1]) >> 1)); $key[2] = chr((ord($string[1]) << 6) | (ord($string[2]) >> 2)); $key[3] = chr((ord($string[2]) << 5) | (ord($string[3]) >> 3)); $key[4] = chr((ord($string[3]) << 4) | (ord($string[4]) >> 4)); $key[5] = chr((ord($string[4]) << 3) | (ord($string[5]) >> 5)); $key[6] = chr((ord($string[5]) << 2) | (ord($string[6]) >> 6)); $key[7] = chr(ord($string[6]) << 1); return openssl_encrypt('KGS!@#$%', 'des-ecb', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); } $ret = test('THE QUI');//The quick brown fox jumps over the lazy dog.'); var_dump($ret); ``` Resulted in this output: ``` PHP 8.1.0: string(8) "f˷mۚ " --> OK PHP 8.2.8: bool(false) --> NOK ``` I expected the same output. ### PHP Version PHP 8.2.8 ### Operating System Windows 10

« previous php.bugs (#245017) next »