【发布时间】:2020-12-11 17:05:52
【问题描述】:
因此,与 codeigniter 集成时,myth-auth 似乎存在错误。
即使$email 为空,它也会尝试验证$password。因此抛出Undefined offset: 1 异常。
在APPPATH\ThirdParty\myth-auth\src\Authentication\Passwords\NothingPersonalValidator.php 第 91 行
84 // Use the pieces as needles and haystacks and look every which way for matches.
85 if($valid)
86 {
87 // Take username apart for use as search needles
88 $needles = $this->strip_explode($userName);
89
90 // extract local-part and domain parts from email as separate needles
91**** [$localPart, $domain] = \explode('@', $email);
92 // might be john.doe@example.com and we want all the needles we can get
93 $emailParts = $this->strip_explode($localPart);
94 if( ! empty($domain))
95 {
96 $emailParts[] = $domain;
97 }
98 $needles = \array_merge($needles, $emailParts);
每当电子邮件字段为空时,总是会抛出该异常,而不是使用重定向返回
'电子邮件为空'
错误信息
【问题讨论】:
-
不存在 Codeigniter 神话验证错误,因为神话验证不是 CI 的一部分。您的代码中可能存在错误,甚至最终在神话身份验证库中也可能存在错误。
-
@Vickel 我真的不明白你的意思
-
在第 73 行之后,添加这一行: if(!$email) $valid = false;
标签: php codeigniter codeigniter-4