Bug #81502 [NEW]: Problem with $tag argument of openssl_decrypt()

From: Date: Mon, 04 Oct 2021 17:12:50 +0000
Subject: Bug #81502 [NEW]: Problem with $tag argument of openssl_decrypt()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237023@lists.php.net to get a copy of this message
From: alec at alec dot pl Operating system: PHP version: 8.1.0RC3 Package: OpenSSL related Bug Type: Bug Bug description:Problem with $tag argument of openssl_decrypt() Description: ------------ If I do: $tag = null; openssl_decrypt($cipher, $method, $ckey, $opts, $iv, $tag); I get: PHP Deprecated: openssl_decrypt(): Passing null to parameter #6 ($tag) of type string is deprecated. But if I do: $tag = ''; openssl_decrypt($cipher, $method, $ckey, $opts, $iv, $tag); I get: PHP Warning: openssl_decrypt(): The tag cannot be used because the cipher algorithm does not support AEAD. I understand the warnings, but this is not convenient if my code is supposed to support AEAD and non-AEAD cipher methods. Do I have to do two code paths depending on the cipher method is used? What's more. The default value for the $tag argument in openssl_encrypt() is null, which sounds kind of inconsistent. -- Edit bug report at https://bugs.php.net/bug.php?id=81502&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81502&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81502&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81502&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81502&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81502&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81502&r=support Expected behavior: https://bugs.php.net/fix.php?id=81502&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81502&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81502&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81502&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81502&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81502&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81502&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81502&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81502&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81502&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81502&r=mysqlcfg

« previous php.bugs (#237023) next »