Skip to content

Commit 5b0f999

Browse files
committed
Check that CURLPROXY_SOCKS4A is available
1 parent 481f74f commit 5b0f999

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/codebird.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -721,16 +721,19 @@ public function setReturnFormat($return_format)
721721
*/
722722
public function setProxy($host, $port, $type = CURLPROXY_HTTP)
723723
{
724-
$this->_proxy['host'] = $host;
725-
$this->_proxy['port'] = (int) $port;
726-
727-
static $types = [
724+
$types = [
728725
CURLPROXY_HTTP, CURLPROXY_SOCKS4, CURLPROXY_SOCKS5,
729-
CURLPROXY_SOCKS4A, CURLPROXY_SOCKS5_HOSTNAME
726+
CURLPROXY_SOCKS5_HOSTNAME
730727
];
728+
if (defined('CURLPROXY_SOCKS4A')) {
729+
$types[] = CURLPROXY_SOCKS4A;
730+
}
731731
if (! in_array($type, $types)) {
732732
throw new \Exception('Invalid proxy type specified.');
733733
}
734+
735+
$this->_proxy['host'] = $host;
736+
$this->_proxy['port'] = (int) $port;
734737
$this->_proxy['type'] = $type;
735738
}
736739

0 commit comments

Comments
 (0)