Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.

Commit 4a20014

Browse files
authored
Merge pull request #60 from peter279k/fix_issue_54
Try to fix issue #54
2 parents 60e2055 + f0d8594 commit 4a20014

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/Purl/Url.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ public function join($url)
196196
$this->initialize();
197197
$parts = $this->getParser()->parseUrl($url);
198198

199+
if ($this->data['scheme'] !== null) {
200+
$parts['scheme'] = $this->data['scheme'];
201+
}
202+
199203
foreach ($parts as $key => $value) {
200204
if ($value !== null) {
201205
$this->data[$key] = $value;

tests/Purl/Test/UrlTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ public function testSetFragment()
130130
$this->assertEquals('http://jwage.com/#about?param1=value1', (string) $url);
131131
}
132132

133+
public function testProtocolRelativeUrl()
134+
{
135+
$url = new Url('https://example.com');
136+
$this->assertEquals('https', $url->join('//code.jquery.com/jquery-3.10.js')->scheme);
137+
}
138+
133139
public function testGetFragment()
134140
{
135141
$url = new Url('http://jwage.com');

0 commit comments

Comments
 (0)