Skip to content

Commit 1033bcf

Browse files
authored
Cast port to int when creating Relay instance (#151)
1 parent 53e70be commit 1033bcf

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

.github/workflows/tests.yml

+48
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,51 @@ jobs:
4646

4747
- name: Test benchmarks
4848
run: composer run bench -- --runs=1
49+
50+
laravel:
51+
52+
name: Laravel
53+
runs-on: ubuntu-latest
54+
timeout-minutes: 5
55+
56+
services:
57+
redis:
58+
image: redis
59+
ports:
60+
- 6379:6379
61+
options: >-
62+
--health-cmd "redis-cli ping"
63+
--health-interval 1s
64+
--health-timeout 1s
65+
--health-retries 5
66+
67+
steps:
68+
- name: Checkout code
69+
uses: actions/checkout@v3
70+
71+
- name: Setup PHP
72+
uses: shivammathur/setup-php@v2
73+
with:
74+
php-version: '8.2'
75+
extensions: redis, relay
76+
tools: composer
77+
coverage: none
78+
79+
- name: Install Laravel installer
80+
run: composer require laravel/installer --no-interaction --prefer-dist --optimize-autoloader
81+
82+
- name: Install Laravel example app
83+
run: composer exec laravel new example-app
84+
85+
- name: Install Composer dependencies
86+
working-directory: example-app
87+
run: |
88+
composer config repositories.cachewerk/relay path ${{ github.workspace }}
89+
composer require cachewerk/relay @dev
90+
91+
- name: Make and run test command
92+
working-directory: example-app
93+
run: |
94+
php artisan make:command VerifyRelay --no-interaction
95+
sed -i 's|//|dump(\\CacheWerk\\Relay\\Laravel\\Relay::stats(), \\Illuminate\\Support\\Facades\\Redis::info());|' app/Console/Commands/VerifyRelay.php
96+
REDIS_CLIENT=relay php artisan app:verify-relay

src/Laravel/RelayConnector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function establishConnection($client, array $config)
136136

137137
$parameters = [
138138
$this->formatHost($config),
139-
$config['port'],
139+
is_scalar($config['port']) ? (int) $config['port'] : 0,
140140
Arr::get($config, 'timeout', 0.0),
141141
$persistent ? Arr::get($config, 'persistent_id', null) : null,
142142
Arr::get($config, 'retry_interval', 0),

0 commit comments

Comments
 (0)