Basically there are two kind of errors you can expiricene when using this client: errors while trying to connect to a broker and errors after sending a certain command to the broker (like authorization errors for example). Also, there is a difference in how errors and hanlded in PHP4 and PHP5 compatible clients.
In case you use the client (or at least the current operation) in a sychronous mode , the client will wait for the broker to send a receipt for every synchronous command. In case that error is received instead of the receipt, the client will report the error. In case you have sent a command in an asynchronous mode the erros will be ignored.
Since PHP4 doesn't support exceptions and it is not nice that library triggers fatal errors, there's a simple error handling approach implemented in PHP4 compatible Stomp client. A false value returned from the method call indicates an error. Also, there are two StompConnection class properties that holds error descriptions:
error contains a short description of the error
exception contains a full stack trace retruned from the broker (if applicable)
So, when you use PHP4 client, be sure that you always check a return value of the method call. Take a look at the folloing code snippet
PHP4 code sample
If used with ActiveMQ broker and try to send an unauthorized message it will return the following errors
User guest is not authorized to write to: queue://test
java.lang.SecurityException: User guest is not authorized to write to: queue://test
at java.lang.Thread.run(Thread.java:595)User guest is not authorized to read from: queue://test