Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在请求验证码mobileRule参数为空的时候会导致500错误 #53

Closed
LGC119 opened this issue Jan 26, 2016 · 12 comments
Closed

在请求验证码mobileRule参数为空的时候会导致500错误 #53

LGC119 opened this issue Jan 26, 2016 · 12 comments

Comments

@LGC119
Copy link

LGC119 commented Jan 26, 2016

在请求验证码mobileRule参数为空,并且URL::previous()无法获取到“path”的时候会导致 $realName = $parsed['path'];请求失败500错误

/**
     * retrieve custom mobile rule
     *
     * @param $token
     * @param string|null $name
     *
     * @throws LaravelSmsException
     *
     * @return mixed
     */
    public function retrieveMobileRule($token, $name = null)
    {
        if (!$name) {
            $parsed = parse_url(URL::previous());
            $realName = $parsed['path'];
        } else {
            $realName = $name;
        }
        $key = $this->getStoreKey($token, self::CUSTOM_RULE_FLAG, $realName);
        $customRule = $this->storage()->get($key, '');
        if ($name && !$customRule) {
            return $this->retrieveMobileRule($token, null);
        }

        return $customRule;
    }
@toplan
Copy link
Owner

toplan commented Jan 26, 2016

请问你是准备用默认验证规则还是自定义验证规则?

@LGC119
Copy link
Author

LGC119 commented Jan 26, 2016

@toplan 默认验证规则

@toplan
Copy link
Owner

toplan commented Jan 26, 2016

ok,能否发一下你的500错误的截图?

@LGC119
Copy link
Author

LGC119 commented Jan 26, 2016

没有任何错误信息,但是我排查了下,是因为parse_url(URL::previous())中没有"path"元素,导致$realName = $parsed['path'];产生错误

@LGC119
Copy link
Author

LGC119 commented Jan 26, 2016

@toplan 问题解决了,是我服务器环境storage没有写权限,导致之前的请求没有缓存,所以获取不到😅,多谢啦。

@toplan
Copy link
Owner

toplan commented Jan 26, 2016

😸

@toplan toplan closed this as completed Jan 26, 2016
@LGC119
Copy link
Author

LGC119 commented Jan 26, 2016

不过在初次请求获取验证码还是会有这个错误,方便的话请看一下吧

@toplan
Copy link
Owner

toplan commented Jan 27, 2016

也就是说,不填写mobileRule的话,初次请求会有报错对吧?

@LGC119
Copy link
Author

LGC119 commented Jan 27, 2016

是的,因为没有上次请求的状态,所以没有path字段

@toplan
Copy link
Owner

toplan commented Jan 27, 2016

嗯,是的,我待会儿会处理下,谢谢你的反馈。

toplan added a commit that referenced this issue Jan 27, 2016
@toplan
Copy link
Owner

toplan commented Jan 27, 2016

@LGC119 已发布v2.2.6解决此问题

@LGC119
Copy link
Author

LGC119 commented Jan 27, 2016

@toplan 好的,多谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants