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()
121121 $ url = null ;
122122
123123 if ($ this ->scheme ) {
124- $ url .= $ this ->scheme . ':// ' ;
124+ $ url .= mb_strtolower ( $ this ->scheme , ' UTF-8 ' ) . ':// ' ;
125125 }
126126
127127 if ($ this ->user ) {
Original file line number Diff line number Diff line change @@ -154,14 +154,31 @@ public function testIdnToAscii()
154154 * Scheme should not be URL encoded
155155 *
156156 * @group issue46
157+ * @group issue51
157158 *
158159 * @see https://tools.ietf.org/html/rfc3986#section-3.1
159160 */
160- public function testToStringDoesNotUrlEncodeScheme ()
161+ public function test__toStringDoesNotUrlEncodeScheme ()
161162 {
162163 // The '+' should not be URL encoded when output to string
163164 $ spec = 'fake-scheme+RFC-3986.compliant://www.graphstory.com ' ;
165+ $ expected = 'fake-scheme+rfc-3986.compliant://www.graphstory.com ' ;
164166 $ 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 ());
166183 }
167184}
You can’t perform that action at this time.
0 commit comments