dongnan4571 2015-11-12 03:17
浏览 51
已采纳

Laravel php工匠修补匠抛出ErrorException

If I run php artisan tinker on my console the output is:

[ErrorException]
in_array() expects parameter 2 to be array, string given

And if I run php artisan tinker --verbose the output is:

Exception trace:
 () at C:\wamp\www\store\vendor\psy\psysh\src\Psy\ConfigPaths.php:161
 Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a
 in_array() at C:\wamp\www\store\vendor\psy\psysh\src\Psy\ConfigPaths.php:161
 Psy\ConfigPaths::getDirNames() at C:\wamp\www\store\vendor\psy\psysh\src\Psy\ConfigPaths.php:35
 Psy\ConfigPaths::getConfigDirs() at C:\wamp\www\store\vendor\psy\psysh\src\Psy\ConfigPaths.php:89
 Psy\ConfigPaths::getConfigFiles() at C:\wamp\www\store\vendor\psy\psysh\src\Psy\Configuration.php:146
 Psy\Configuration->getConfigFile() at C:\wamp\www\store\vendor\psy\psysh\src\Psy\Configuration.php:117
 Psy\Configuration->init() at C:\wamp\www\store\vendor\psy\psysh\src\Psy\Configuration.php:98
 Psy\Configuration->__construct() at C:\wamp\www\store\vendor\laravel\framework\src\Illuminate\Foundation\Console\TinkerCommand.php:44
 Illuminate\Foundation\Console\TinkerCommand->fire() at n/a:n/a
 call_user_func_array() at C:\wamp\www\store\vendor\laravel\framework\src\Illuminate\Container\Container.php:503
 Illuminate\Container\Container->call() at C:\wamp\www\store\vendor\laravel\framework\src\Illuminate\Console\Command.php:150
 Illuminate\Console\Command->execute() at C:\wamp\www\store\vendor\symfony\console\Command\Command.php:256
 Symfony\Component\Console\Command\Command->run() at C:\wamp\www\store\vendor\laravel\framework\src\Illuminate\Console\Command.php:136
 Illuminate\Console\Command->run() at C:\wamp\www\store\vendor\symfony\console\Application.php:838
 Symfony\Component\Console\Application->doRunCommand() at C:\wamp\www\store\vendor\symfony\console\Application.php:189
 Symfony\Component\Console\Application->doRun() at C:\wamp\www\store\vendor\symfony\console\Application.php:120
 Symfony\Component\Console\Application->run() at C:\wamp\www\store\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:107
 Illuminate\Foundation\Console\Kernel->handle() at C:\wamp\www\store\artisan:36

Extra:
My Laravel version is 5.1.24.
I've just installed Zizaco/entrust
Other than that, the app is almost blank


EDIT:

Here is the function guilty for the error inside 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;
}

If someone has the same issue, here is how I solved it:

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

Thanks in advance!

  • 写回答

2条回答 默认 最新

  • dqcuq4138 2015-11-12 03:58
    关注

    Check the values on C:\wamp\www\store\vendor\psy\psysh\src\Psy\ConfigPaths.php it seems like there is something wrong with those values because when the script calls in_array function doesn't get the correct values

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog