Skip to content

Wrong usage of ServerException #650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jeff1985 opened this issue Nov 22, 2018 · 0 comments
Closed

Wrong usage of ServerException #650

jeff1985 opened this issue Nov 22, 2018 · 0 comments
Milestone

Comments

@jeff1985
Copy link
Contributor

During testing of #648 configuration, I got an different issue with the usage of ServerException.

I.e. in enqueue/redis/RedisProducer.php:70 you have the following code:

catch (PRedisServerException $e) {
        throw new ServerException('lpush command has failed', null, $e);
    }

In case of an exception I'm getting:

[Symfony\Component\Debug\Exception\FatalThrowableError]
Wrong parameters for Enqueue\Redis\ServerException([string $message [, long $code [, 
Throwable $previous = NULL]]])

Which is because of the null parameter. ServerException is a subclass of \Exception and the __construct() is defined as:
(see http://php.net/manual/de/class.exception.php )

public __construct ([ string $message = "" [, int $code = 0 [, Throwable $previous = NULL ]]] )

null is not int, so you'll need to pass 0 in your exception calls.

For reference:

$ php -v 
PHP 7.1.19-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jul  9 2018 13:12:24) ( NTS )
@makasim makasim added the bug label Nov 22, 2018
@makasim makasim added this to the 0.9 milestone Nov 22, 2018
makasim added a commit to php-enqueue/redis that referenced this issue Nov 23, 2018
@makasim makasim added the 0.9 label Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants