phpinnacle / ridge

Pure asynchronous PHP implementation of the AMQP 0-9-1 protocol.
MIT License
50 stars 13 forks source link

Missing exception on COnnectionCloseFrame with error code #10

Closed brzuchal closed 4 years ago

brzuchal commented 5 years ago

Detailed description

When connecting to RMQ fails ConnectionCloseFrame is handled but no exception in case of error is thrown.

DSN

amqp://test:test@localhost:5672/test

ConnectionCloseFrame

    object(PHPinnacle\Ridge\Protocol\ConnectionCloseFrame)#866 (10) {
      ["replyCode"]=>
      int(530)
      ["replyText"]=>
      string(81) "NOT_ALLOWED - access to vhost '/test' refused for user 'test'"
      ["closeClassId"]=>
      int(10)
      ["closeMethodId"]=>
      int(40)
      ["classId"]=>
      int(10)
      ["methodId"]=>
      int(50)
      ["type"]=>
      int(1)
      ["channel"]=>
      int(0)
      ["size"]=>
      int(92)
      ["payload"]=>
      NULL
    }

Context

The change is important for all users using non-default vhost.

Possible implementation

Possible fix should add \trim($url['path'], '/') in Config::parse

Environment

zloyuser commented 5 years ago

Hi, thank you for reported issue.

The main problem here that RabbitMQ allows create vhost with / in name. Something like /test//my/vhost/// is valid RabbitMQ vhost.