This repository was archived by the owner on Jul 7, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +46
-1
lines changed
tests/TestCase/Wrapper/CakePHP Expand file tree Collapse file tree 3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,14 @@ protected function parseUrlArray($url)
239239
240240 $ url = array_merge ($ this ->uriKeys , $ url );
241241
242+ foreach (['host ' , 'user ' , 'pass ' ] as $ key ) {
243+ if (!isset ($ url [$ key ])) {
244+ continue ;
245+ }
246+
247+ $ url [$ key ] = urldecode ($ url [$ key ]);
248+ }
249+
242250 foreach ($ url as $ key => $ val ) {
243251 $ setter = 'set ' . ucfirst ($ key );
244252 $ this ->$ setter ($ val );
@@ -289,6 +297,14 @@ protected function toUrlArray($data)
289297 {
290298 $ url = array_intersect_key ($ data , $ this ->uriKeys );
291299
300+ foreach (['host ' , 'user ' , 'pass ' ] as $ key ) {
301+ if (!isset ($ url [$ key ])) {
302+ continue ;
303+ }
304+
305+ $ url [$ key ] = urlencode ($ url [$ key ]);
306+ }
307+
292308 if ($ url ['adapter ' ]) {
293309 $ return = $ url ['scheme ' ] . '+ ' . $ url ['adapter ' ] . ':// ' ;
294310 } else {
@@ -315,7 +331,6 @@ protected function toUrlArray($data)
315331 if ($ query ) {
316332 foreach ($ query as $ key => &$ value ) {
317333 if (is_array ($ value )) {
318-
319334 $ intermediate = [];
320335 foreach ($ value as $ k => $ v ) {
321336 $ v = urlencode ($ v );
Original file line number Diff line number Diff line change @@ -73,6 +73,21 @@ public function defaultsProvider()
7373 'layout ' => false ,
7474 'timeout ' => 30 ,
7575 ]
76+ ],
77+ [
78+ 'smtp://user:secret@ssl%3A%2F%2Flocalhost:465/?from=you@localhost&messageId=1&template=0&layout=0&timeout=30 ' ,
79+ [
80+ 'transport ' => 'Smtp ' ,
81+ 'host ' => 'ssl://localhost ' ,
82+ 'port ' => 465 ,
83+ 'username ' => 'user ' ,
84+ 'password ' => 'secret ' ,
85+ 'from ' => 'you@localhost ' ,
86+ 'messageId ' => true ,
87+ 'template ' => false ,
88+ 'layout ' => false ,
89+ 'timeout ' => 30 ,
90+ ]
7691 ]
7792 ];
7893 }
Original file line number Diff line number Diff line change @@ -79,6 +79,21 @@ public function defaultsProvider()
7979 'layout ' => false ,
8080 'timeout ' => 30 ,
8181 ]
82+ ],
83+ [
84+ 'smtp://user:secret@ssl%3A%2F%2Flocalhost:465/?from=you@localhost&messageId=1&template=0&layout=0&timeout=30 ' ,
85+ [
86+ 'className ' => 'Smtp ' ,
87+ 'host ' => 'ssl://localhost ' ,
88+ 'port ' => 465 ,
89+ 'username ' => 'user ' ,
90+ 'password ' => 'secret ' ,
91+ 'from ' => 'you@localhost ' ,
92+ 'messageId ' => true ,
93+ 'template ' => false ,
94+ 'layout ' => false ,
95+ 'timeout ' => 30 ,
96+ ]
8297 ]
8398 ];
8499 }
You can’t perform that action at this time.
0 commit comments