Skip to content

ArgumentCountError Thrown When Using openssl_public_encrypt and Other OpenSSL Functions #18387

@alperenuzun

Description

@alperenuzun

Description

After migrating from Amazon Linux 2 to Ubuntu 22.04 — and upgrading OpenSSL from version 1.0.2 to 3.0.2 — I have encountered two recurring types of errors:


1. OpenSSL Encryption Method Errors (ArgumentCountError)

When calling the openssl_public_encrypt function, it seems the method signature has changed, resulting in errors such as:

openssl_public_encrypt() expects exactly 1 argument, 4 given
openssl_public_encrypt() expects exactly 2 arguments, 4 given
openssl_public_encrypt() expects at most 3 arguments, 4 given

Other methods also show similar inconsistencies:

openssl_pkey_get_private() expects at least 2 arguments, 1 given
openssl_pkey_get_private() expects exactly 1 argument, 1 given

While this may indicate changes in method signatures or internal validation logic, it's still unclear why different ArgumentCountError messages are thrown for the same method.


2. cURL Errors

cURL error 35: error:03000072:digital envelope routines::decode error

This error occurs intermittently, particularly during peak request times.


Error Frequency: 10–20 times per day (Not always)
OpenSSL Version: 3.0.9


Questions

  • Has anyone else experienced similar issues after upgrading to OpenSSL 3.x and Ubuntu 22.04?
  • Could this be related to the PHP version or its OpenSSL extension compatibility?

Any insights or suggestions would be greatly appreciated.

Best regards,

PHP Version

PHP 8.1.31 (cli) (built: Nov 21 2024 13:10:15) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.31, Copyright (c) Zend Technologies
with Zend OPcache v8.1.31, Copyright (c), by Zend Technologies

Operating System

Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions