Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PcreException.php

function PcreException::pcreLastErrorMessage

Parameters

int $code:

Return value

string

1 call to PcreException::pcreLastErrorMessage()
PcreException::fromFunction in vendor/composer/pcre/src/PcreException.php

File

vendor/composer/pcre/src/PcreException.php, line 36

Class

PcreException

Namespace

Composer\Pcre

Code

private static function pcreLastErrorMessage($code) {
    if (function_exists('preg_last_error_msg')) {
        return preg_last_error_msg();
    }
    $constants = get_defined_constants(true);
    if (!isset($constants['pcre']) || !is_array($constants['pcre'])) {
        return 'UNDEFINED_ERROR';
    }
    foreach ($constants['pcre'] as $const => $val) {
        if ($val === $code && substr($const, -6) === '_ERROR') {
            return $const;
        }
    }
    return 'UNDEFINED_ERROR';
}
RSS feed
Powered by Drupal