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

laravel5.4最新更新后php artisan 报错[ErrorException] Illegal offset type in unset #100

Closed
linganmin opened this issue Mar 27, 2017 · 1 comment

Comments

@linganmin
Copy link

linganmin commented Mar 27, 2017

使用最新的laravel版本,使用本扩展,在执行php artisan时报错

[ErrorException] Illegal offset type in unset

debug后发现是这段代码出错,

$this->app->singleton([
            'Toplan\\Sms\\SmsManager' => 'laravel-sms',
        ], function ($app) {
            $token = $app->request->header('access-token', null);
            if (empty($token)) {
                $token = $app->request->input('access_token', null);
            }
            $input = $app->request->all();

            return new SmsManager($token, $input);
        });

猜测应该是新版本laravel的singletion绑定时不能再使用数组,
代码更改为如下后就正常了,

$this->app->singleton('Toplan\\Sms\\SmsManager', function ($app) {
            $token = $app->request->header('access-token', null);
            if (empty($token)) {
                $token = $app->request->input('access_token', null);
            }
            $input = $app->request->all();

            return new SmsManager($token, $input);
        });

希望可以发布一个新版本修复一下,谢谢

@toplan
Copy link
Owner

toplan commented Mar 27, 2017

laravel-sms已发布2.6.2
phpsms已经发布1.7.1

@toplan toplan closed this as completed Mar 27, 2017
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