Skip to content

Commit 4feac45

Browse files
committed
Explicitly check for socket_import_stream()
Could be missing in a PHP 5.4+ installation without ext-sockets
1 parent 371095b commit 4feac45

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Factory.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
class Factory
1111
{
1212
private $loop;
13-
private $rawFactory;
14-
private $datagramFactory;
1513

1614
public function __construct(LoopInterface $loop)
1715
{
@@ -31,7 +29,10 @@ public function createSender()
3129
public function createReceiver($address)
3230
{
3331
if (!defined('MCAST_JOIN_GROUP')) {
34-
throw new BadMethodCallException('MCAST_JOIN_GROUP not defined');
32+
throw new BadMethodCallException('MCAST_JOIN_GROUP not defined (requires PHP 5.4+)');
33+
}
34+
if (!function_exists('socket_import_stream')) {
35+
throw new BadMethodCallException('Function socket_import_stream missing (requires ext-sockets and PHP 5.4+)');
3536
}
3637

3738
$parts = parse_url('udp://' . $address);

0 commit comments

Comments
 (0)