Merge remote-tracking branch 'github-fntlnz/fix-bug-68497'
commit
aafb968d49
|
@ -0,0 +1,28 @@
|
|||
.deps
|
||||
.libs/
|
||||
Makefile
|
||||
Makefile.fragments
|
||||
Makefile.global
|
||||
Makefile.objects
|
||||
acinclude.m4
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.nice
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.in
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
modules/
|
||||
php_stomp.lo
|
||||
run-tests.php
|
||||
stomp.la
|
||||
stomp.lo
|
11
php_stomp.c
11
php_stomp.c
|
@ -543,6 +543,17 @@ PHP_FUNCTION(stomp_connect)
|
|||
res = stomp_read_frame(stomp);
|
||||
if (NULL == res) {
|
||||
STOMP_ERROR(0, PHP_STOMP_ERR_SERVER_NOT_RESPONDING);
|
||||
} else if (0 == strncmp("ERROR", res->command, sizeof("ERROR") - 1)) {
|
||||
char *error_msg = NULL;
|
||||
if (zend_hash_find(res->headers, "message", sizeof("message"), (void **)&error_msg) == SUCCESS) {
|
||||
zval *excobj = zend_throw_exception_ex(stomp_ce_exception, 0 TSRMLS_CC, error_msg);
|
||||
if (res->body) {
|
||||
zend_update_property_string(stomp_ce_exception, excobj, "details", sizeof("details")-1, (char *) res->body TSRMLS_CC);
|
||||
}
|
||||
|
||||
stomp_free_frame(res);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else if (0 != strncmp("CONNECTED", res->command, sizeof("CONNECTED")-1)) {
|
||||
if (stomp->error) {
|
||||
STOMP_ERROR_DETAILS(stomp->errnum, stomp->error, stomp->error_details);
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
--TEST--
|
||||
Test stomp_connect() - Test error on CONNECT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("stomp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
$stomp = new Stomp('tcp://localhost', 'anotpresentusername1234');
|
||||
} catch (Exception $e) {
|
||||
var_dump(get_class($e));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(14) "StompException"
|
Loading…
Reference in New Issue