Automattic\WooCommerce\EmailEditorVendor\Pelago\Emogrifier\Utilities
Preg::logOrThrowPregLastError
Obtains the name of the error constant for preg_last_error (based on code posted at {@see https://www.php.net/manual/en/function.preg-last-error.php#124124}) and puts it into an error message which is either passed to trigger_error or used in the exception which is thrown (depending on the $throwExceptions property).
Метод класса: Preg{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->logOrThrowPregLastError(): void;
Код Preg::logOrThrowPregLastError() Preg::logOrThrowPregLastError WC 11.3.0
private function logOrThrowPregLastError(): void
{
$pcreConstants = \get_defined_constants(true)['pcre'];
$pcreErrorConstantNames = \array_flip(\array_filter(
$pcreConstants,
static function (string $key): bool {
return \substr($key, -6) === '_ERROR';
},
ARRAY_FILTER_USE_KEY
));
$pregLastError = \preg_last_error();
$message = 'PCRE regex execution error `' . (string) ($pcreErrorConstantNames[$pregLastError] ?? $pregLastError)
. '`';
if ($this->throwExceptions) {
throw new \RuntimeException($message, 1592870147);
}
\trigger_error($message);
}