This repository was archived by the owner on Jan 31, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,9 @@ function getNewValidTlds($string)
177
177
function getPunycodeDecoder ()
178
178
{
179
179
if (function_exists ('idn_to_utf8 ' )) {
180
- return 'idn_to_utf8 ' ;
180
+ return function ($ domain ) {
181
+ return idn_to_utf8 ($ domain , 0 , INTL_IDNA_VARIANT_UTS46 );
182
+ };
181
183
}
182
184
183
185
$ hostnameValidator = new Hostname ();
Original file line number Diff line number Diff line change @@ -530,7 +530,7 @@ public function isValid($value)
530
530
protected function idnToAscii ($ email )
531
531
{
532
532
if (extension_loaded ('intl ' )) {
533
- return (idn_to_ascii ($ email ) ?: $ email );
533
+ return (idn_to_ascii ($ email, 0 , INTL_IDNA_VARIANT_UTS46 ) ?: $ email );
534
534
}
535
535
return $ email ;
536
536
}
@@ -553,7 +553,7 @@ protected function idnToUtf8($email)
553
553
// the source string in those cases.
554
554
// But not when the source string is long enough.
555
555
// Thus we default to source string ourselves.
556
- return idn_to_utf8 ($ email ) ?: $ email ;
556
+ return idn_to_utf8 ($ email, 0 , INTL_IDNA_VARIANT_UTS46 ) ?: $ email ;
557
557
}
558
558
return $ email ;
559
559
}
Original file line number Diff line number Diff line change 9
9
10
10
namespace Zend \Validator \File ;
11
11
12
+ use Countable ;
12
13
use Zend \Validator \AbstractValidator ;
13
14
use Zend \Validator \Exception ;
14
15
@@ -109,7 +110,7 @@ public function getFiles($file = null)
109
110
*/
110
111
public function setFiles ($ files = [])
111
112
{
112
- if (count ($ files ) === 0 ) {
113
+ if (( is_array ( $ files ) || $ files instanceof Countable) && count ($ files ) === 0 ) {
113
114
$ this ->options ['files ' ] = $ _FILES ;
114
115
} else {
115
116
$ this ->options ['files ' ] = $ files ;
You can’t perform that action at this time.
0 commit comments