Skip to content

Fatal Error when using channel after disconnect #218

@dantleech

Description

@dantleech

More of a DX issue:

$client = new Client(new Configuration(
    host: 'amqp',
));

$client->connect();
$channel = $client->channel();
$channel->publish('foobar');

$client->disconnect();
$channel->publish('barfoo');

Gives:

PHP Fatal error:  Uncaught AssertionError: assert(\is_callable($ret)) in /app/vendor/react/async/src/SimpleFiber.php:72
Stack trace:
#0 /app/vendor/react/async/src/SimpleFiber.php(72): assert(false, 'assert(\\is_call...')
#1 /app/vendor/react/async/src/functions.php(365): React\Async\SimpleFiber->suspend()
#2 /app/vendor/bunny/bunny/src/Connection.php(143): React\Async\await(Object(React\Promise\Promise))
#3 /app/vendor/bunny/bunny/src/Connection.php(1697): Bunny\Connection->flushWriteBuffer()
#4 /app/vendor/bunny/bunny/src/ChannelMethods.php(165): Bunny\Connection->publish(1, 'barfoo', Array, '', '', false, false)
#5 /app/vendor/bunny/bunny/src/Channel.php(337): Bunny\Channel->publishImpl('barfoo', Array, '', '', false, false)
#6 /app/test.php(19): Bunny\Channel->publish('barfoo')
#7 {main}
  thrown in /app/vendor/react/async/src/SimpleFiber.php on line 72

But shuold probably throw an exception such as Connection is closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions