forked from php-amqp/php-amqp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix segfault when channel zval type != IS_OBJECT
- Loading branch information
Showing
3 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--TEST-- | ||
AMQPExchange - declare with stalled reference | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("amqp")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
class ConnectionMock extends AMQPConnection { | ||
public function __construct(array $credentials = array()) | ||
{ | ||
} | ||
} | ||
|
||
class ChannelMock extends AMQPChannel { | ||
public function __construct(AMQPConnection $amqp_connection) | ||
{ | ||
} | ||
} | ||
|
||
class ExchangeMock extends \AMQPExchange | ||
{ | ||
public function __construct(AMQPChannel $amqp_channel) | ||
{ | ||
} | ||
} | ||
|
||
$cnn = new ConnectionMock(); | ||
$ch = new ChannelMock($cnn); | ||
|
||
$e = new ExchangeMock($ch); | ||
|
||
|
||
try { | ||
$e->declareExchange(); | ||
} catch (\Exception $e) { | ||
echo get_class($e), ': ', $e->getMessage(), PHP_EOL; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
AMQPChannelException: Could not declare exchange. Stale reference to the channel object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--TEST-- | ||
AMQPQueue - declare with stalled reference | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("amqp")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
class ConnectionMock extends AMQPConnection { | ||
public function __construct(array $credentials = array()) | ||
{ | ||
} | ||
} | ||
|
||
class ChannelMock extends AMQPChannel { | ||
public function __construct(AMQPConnection $amqp_connection) | ||
{ | ||
} | ||
} | ||
|
||
class QueueMock extends \AMQPQueue | ||
{ | ||
public function __construct(AMQPChannel $amqp_channel) | ||
{ | ||
} | ||
} | ||
|
||
$cnn = new ConnectionMock(); | ||
$ch = new ChannelMock($cnn); | ||
|
||
$e = new QueueMock($ch); | ||
|
||
|
||
try { | ||
$e->declareQueue(); | ||
} catch (\Exception $e) { | ||
echo get_class($e), ': ', $e->getMessage(), PHP_EOL; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
AMQPChannelException: Could not declare queue. Stale reference to the channel object. |