Skip to content

Commit c199441

Browse files
auto remove scheme from URI
1 parent aa43ed7 commit c199441

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/connection/AConnection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ abstract class AConnection implements IConnection
2020
*/
2121
public function __construct(string $ip = '127.0.0.1', int $port = 7687, float $timeout = 15)
2222
{
23+
if (filter_var($ip, FILTER_VALIDATE_URL)) {
24+
$scheme = parse_url($ip, PHP_URL_SCHEME);
25+
if (!empty($scheme)) {
26+
$ip = str_replace($scheme . '://', '', $ip);
27+
}
28+
}
29+
2330
$this->ip = $ip;
2431
$this->port = $port;
2532
$this->timeout = $timeout;

tests/BoltTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testSockets()
6666
public function testAura()
6767
{
6868
try {
69-
$conn = new \Bolt\connection\StreamSocket('demo.neo4jlabs.com');
69+
$conn = new \Bolt\connection\StreamSocket('neo4j+s://demo.neo4jlabs.com');
7070
$conn->setSslContextOptions([
7171
'verify_peer' => true
7272
]);

0 commit comments

Comments
 (0)