Skip to content

Commit d5dd5d1

Browse files
committed
use renamed trustedproxies setting in tests
1 parent 2f828ab commit d5dd5d1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

_test/tests/inc/Ip.test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ public function proxy_is_trusted_provider(): array
209209
*
210210
* @dataProvider proxy_is_trusted_provider
211211
*
212-
* @param string|string[] $config The value for $conf[trustedproxy].
212+
* @param string|string[] $config The value for $conf[trustedproxies].
213213
* @param string $ip The proxy IP to test.
214214
* @param bool $expected The expected result from proxyIsTrusted().
215215
*/
216216
public function test_proxy_is_trusted($config, string $ip, bool $expected): void
217217
{
218218
global $conf;
219-
$conf['trustedproxy'] = $config;
219+
$conf['trustedproxies'] = $config;
220220

221221
$result = Ip::proxyIsTrusted($ip);
222222

@@ -312,7 +312,7 @@ public function forwarded_for_provider(): array
312312
*
313313
* @dataProvider forwarded_for_provider
314314
*
315-
* @param string|string[] $config The trustedproxy config value.
315+
* @param string|string[] $config The trustedproxies config value.
316316
* @param string $header The X-Forwarded-For header value.
317317
* @param string $remoteAddr The TCP/IP peer address.
318318
* @param array $expected The expected result from forwardedFor().
@@ -324,7 +324,7 @@ public function test_forwarded_for($config, string $header, string $remoteAddr,
324324
/* @var Input $INPUT */
325325
global $INPUT, $conf;
326326

327-
$conf['trustedproxy'] = $config;
327+
$conf['trustedproxies'] = $config;
328328
$INPUT->server->set('HTTP_X_FORWARDED_FOR', $header);
329329
$INPUT->server->set('REMOTE_ADDR', $remoteAddr);
330330

_test/tests/inc/common_clientip.test.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class common_clientIP_test extends DokuWikiTest {
44

55
/**
6-
* @var mixed[] $configs Possible values for $conf['trustedproxy'].
6+
* @var mixed[] $configs Possible values for $conf['trustedproxies'].
77
*/
88
private $configs = [
99
'^(::1|[fF][eE]80:|127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)',
@@ -110,7 +110,7 @@ public function test_client_ip_v4(string $remoteAddr, bool $useRealIp, string $r
110110
$conf['realip'] = $useRealIp;
111111

112112
foreach ($this->configs as $config) {
113-
$conf['trustedproxy'] = $config;
113+
$conf['trustedproxies'] = $config;
114114
$this->assertEquals(str_replace(array_keys($addresses), array_values($addresses), $expected), clientIP($single));
115115
}
116116
}
@@ -146,7 +146,7 @@ public function test_client_ip_v6(string $remoteAddr, bool $useRealIp, string $r
146146
$conf['realip'] = $useRealIp;
147147

148148
foreach ($this->configs as $config) {
149-
$conf['trustedproxy'] = $config;
149+
$conf['trustedproxies'] = $config;
150150
$this->assertEquals(str_replace(array_keys($addresses), array_values($addresses), $expected), clientIP($single));
151151
}
152152
}

inc/common.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,14 +784,14 @@ function checkwordblock($text = '')
784784
* The IP is sourced from, in order of preference:
785785
*
786786
* - The X-Real-IP header if $conf[realip] is true.
787-
* - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxy].
787+
* - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxies].
788788
* - The TCP/IP connection remote address.
789789
* - 0.0.0.0 if all else fails.
790790
*
791791
* The 'realip' config value should only be set to true if the X-Real-IP header
792792
* is being added by the web server, otherwise it may be spoofed by the client.
793793
*
794-
* The 'trustedproxy' setting must not allow any IP, otherwise the X-Forwarded-For
794+
* The 'trustedproxies' setting must not allow any IP, otherwise the X-Forwarded-For
795795
* may be spoofed by the client.
796796
*
797797
* @param bool $single If set only a single IP is returned.

0 commit comments

Comments
 (0)