What about this implementation:
```php
set_error_handler(function() {
     global $pattern, $message, $propertyPath;
     throw static::createException($pattern, $message, static::INVALID_IS_REGEX , $propertyPath, array('pattern' => $pattern));
 });

preg_match($pattern, "foobar");

restore_error_handler();
```