Laravel-php手工修补程序抛出ErrorException


Laravel php artisan tinker throwing ErrorException

如果我在控制台上运行php artisan tinker,输出为:

[ErrorException]in_array()要求参数2为数组,给定字符串

如果我运行php artisan tinker --verbose,输出为:

异常跟踪:()位于C:''wamp''www''store''vendor''psy''pysh''src''psy''ConfigPaths.php:161Illuminate''Foundation''Bootstrap''HandleExceptions->handleError()在n/a:n/ain_array(),位于C:''wamp''www''store''vendor''psy''pysh''src''psy''ConfigPaths.php:161Psy''ConfigPaths::getDirNames(),位于C:''wamp''www''store''vendor''Psy''pysh''src''Psy''ConfigPaths.php:35Psy''ConfigPaths::getConfigDirs(),位于C:''wamp''www''store''vendor''Psy''pysh''src''Psy''ConfigPaths.php:89Psy''ConfigPaths::getConfigFiles(),位于C:''wamp''www''store''vendor''Psy''pysh''src''Psy''Configuration.php:146Psy''Configuration->getConfigFile(),位于C:''wamp''www''store''vendor''Psy''psyh''src''Psy''Configuration.php:117Psy''Configuration->init(),位于C:''wamp''www''store''vendor''Psy''psyh''src''Psy''Configuration.php:98Psy''Configuration->__construct(),位于C:''wamp''www''store''vendor''laravel''framework''src''Illuminate''Foundation''Conset''TinkerCommand.php:44照明''基础''控制台''修补程序命令->fire()在n/a:n/acall_user_func_array(),位于C:''wamp''www''store''vendor''laravel''framework''src''Illuminate''Container''Container.php:503Illuminate''Container''Container->call(),位于C:''wamp''www''store''vendor''laravel''framework''src''Illuminates''Console''Command.php:150Illuminate''Console''Command->execute(),位于C:''wamp''www''store''vendor''symfony''coconsole''Command.php:256Symfony''Component''Console''Command''Command->run(),位于C:''wamp''www''store''vendor''laravel''framework''src''Illuminate''Console''Command.php:136Illuminate''Console''Command->run(),位于C:''wamp''www''store''vendor''symfony''coconsole''Application.php:838Symfony''Component''Console''Application->doRunCommand(),位于C:''wamp''www''store''vendor''Symfony''coconsole''Application.php:189Symfony''Component''Console''Application->doRun(),位于C:''wamp''www''store''vendor''Symfony''coconsole''Application.php:120Symfony''Component''Console''Application->run(),位于C:''wamp''www''store''vendor''laravel''framework''src''Illuminate''Foundation''Console''Kernel.php:107位于C:''wamp''www''store''artisan:36的Illuminate''Foundation''Console''Kernel->handle()

额外:
我的Laravel版本是5.1.24。
我刚刚安装了Zizaco/委托
除此之外,该应用程序几乎是空白


编辑:

以下是ConfigPaths.php中错误的函数:

private static function getDirNames(array $baseDirs) {
    $dirs = array_map(function ($dir) {
        return strtr($dir, '''', '/') . '/psysh';
    }, $baseDirs);
    // Add ~/.psysh
    if ($home = getenv('HOME')) {
        $dirs[] = strtr($home, '''', '/') . '/.psysh';
    }
    // Add some Windows specific ones :)
    if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
        if ($appData = getenv('APPDATA')) {
            // AppData gets preference
            array_unshift($dirs, strtr($appData, '''', '/') . '/PsySH');
        }
        $dir = strtr(getenv('HOMEDRIVE') . '/' . getenv('HOMEPATH'), '''', '/') . '/.psysh';
        if (!in_array($dirs, $dir)) {
            $dirs[] = $dir;
        }
    }
    return $dirs;
}

如果有人有同样的问题,下面是我如何解决的:

# add (array) before $dir
if (!in_array($dirs, (array)$dir)) {
    $dirs[] = $dir;
}

提前感谢!

这也发生在我身上。

执行composer update并将软件包更新为psy/psysh(v0.6.1)修复了问题。

检查C:''wamp''www''store''vendor''psy''pysh''src''psy''ConfigPaths.php上的值,这些值似乎有问题,因为当脚本调用in_array函数时,没有得到正确的值