openssl_csr_get_subject

FunctionParams and return types changed in PHP 8.0

Returns the subject of a CSR.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

openssl_csr_get_subject Function synopsis

openssl_csr_get_subject(OpenSSLCertificateSigningRequest|string $csr, bool $short_names = true): array|false

Parameters

$csr

TypeOpenSSLCertificateSigningRequest|string

$short_names

OptionalTypeboolDefault valuetrue

$short_names controls how the data is indexed in the array - if $short_names is true (the default) then fields will be indexed with the short name form, otherwise, the long name form will be used - e.g.: CN is the shortname form of commonName.

Return value

Typearray|false

Returns an associative array with subject description, or false on failure.

Changes to the openssl_csr_get_subject Function

PHP 8.0

  • Return type added: array|false
  • Parameter type added for parameter #1 ($csr): OpenSSLCertificateSigningRequest|string
  • Parameter name of parameter #2 changed: $use_shortnames to $short_names
  • Parameter type added for parameter #2 ($short_names): bool
  • Parameter default value added for position #2 ($short_names): true
- openssl_csr_get_subject($csr, $use_shortnames)
+ openssl_csr_get_subject(OpenSSLCertificateSigningRequest|string $csr, bool $short_names = true): array|false

PHP 7.1

  • Optional parameter added - #2: $use_shortnames
- openssl_csr_get_subject($csr)
+ openssl_csr_get_subject($csr, $use_shortnames)

openssl_csr_get_subject Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes
PHP 8.5Supported (Latest) Yes
PHP 8.4Supported Yes
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes