minor #21454 [Cache] Fix trigger_error (jderusse)

This PR was squashed before being merged into the 3.3-dev branch (closes #21454).

Discussion
----------

[Cache] Fix trigger_error

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | NA

Commits
-------

ca38551 [Cache] Fix trigger_error
This commit is contained in:
Nicolas Grekas 2017-01-29 20:06:27 +01:00
commit 6791124f93

View File

@ -73,11 +73,11 @@ trait MemcachedTrait
} elseif (!is_array($servers)) {
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, %s given.', gettype($servers)));
}
if (!static::isSupported()) {
throw new CacheException('Memcached >= 2.2.0 is required');
}
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
try {
if (!static::isSupported()) {
throw new trigger_error('Memcached >= 2.2.0 is required');
}
$options += static::$defaultClientOptions;
$client = new \Memcached($options['persistent_id']);
$username = $options['username'];