File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ public function __toString()
121
121
$ url = null ;
122
122
123
123
if ($ this ->scheme ) {
124
- $ url .= $ this ->scheme . ':// ' ;
124
+ $ url .= mb_strtolower ( $ this ->scheme , ' UTF-8 ' ) . ':// ' ;
125
125
}
126
126
127
127
if ($ this ->user ) {
Original file line number Diff line number Diff line change @@ -154,14 +154,31 @@ public function testIdnToAscii()
154
154
* Scheme should not be URL encoded
155
155
*
156
156
* @group issue46
157
+ * @group issue51
157
158
*
158
159
* @see https://tools.ietf.org/html/rfc3986#section-3.1
159
160
*/
160
- public function testToStringDoesNotUrlEncodeScheme ()
161
+ public function test__toStringDoesNotUrlEncodeScheme ()
161
162
{
162
163
// The '+' should not be URL encoded when output to string
163
164
$ spec = 'fake-scheme+RFC-3986.compliant://www.graphstory.com ' ;
165
+ $ expected = 'fake-scheme+rfc-3986.compliant://www.graphstory.com ' ;
164
166
$ url = $ this ->parser ->parseUrl ($ spec );
165
- $ this ->assertEquals ($ spec , $ url ->__toString ());
167
+ $ this ->assertEquals ($ expected , $ url ->__toString ());
168
+ }
169
+
170
+ /**
171
+ * Scheme should be output in lowercase regardless of case of original arg
172
+ *
173
+ * @group issue51
174
+ *
175
+ * @see https://tools.ietf.org/html/rfc3986#section-3.1
176
+ */
177
+ public function testSchemeAlwaysConvertedToLowerCasePerRFC3986 ()
178
+ {
179
+ $ spec = 'HttPS://www.google.com ' ;
180
+ $ expected = 'https://www.google.com ' ;
181
+ $ url = $ this ->parser ->parseUrl ($ spec );
182
+ $ this ->assertEquals ($ expected , $ url ->__toString ());
166
183
}
167
184
}
You can’t perform that action at this time.
0 commit comments