如果我在我的控制台上运行php artisan tinker
,输出是:
[ErrorException] in_array() expects parameter 2 to be array, string given
如果我运行php artisan tinker--everose
,输出是:
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
额外:
我的Laravel版本是5.1.24。
我刚刚安装了Zizaco/委托
除此之外,应用程序几乎是空白的
编辑:
这是ConfigPath. 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;
}
提前感谢!
这也发生在我身上。
执行作曲家更新
并将包更新为psy/Mind sh(v0.6.1)修复了问题。
检查C:\wamp\www\store\供应商\psy\Mind sh\src\Psy\ConfigPath. php上的值,这些值似乎有问题,因为当脚本调用in_array函数时没有得到正确的值