Skip to content

[Bug]: PHP Parse Error in Laravel Extension on DDEV Environment with WSL2 #85

@krudi

Description

@krudi

Extension Version

0.1.12

PHP Binary

Docker

Operating System

Windows

What happened?

When I activate the Laravel Extension in VS Code while using a DDEV-based Docker environment on WSL2, I get a PHP Parse Error stating there's an Unclosed ( in the command-line code executed by the extension. Even though the Laravel project is running correctly in the environment, the extension doesn’t initialize. Do I need to set up any special configuration for this setup to make it work?

I wanted to mention that I have an alias for the PHP command, which executes everything in the PHP container. The alias is as follows:

path=$(printf '%s\n' "${PWD##*/}")
command="ddev php "$@""
$command

Mimimal Code Sample

024-12-18 20:46:19.835 [error] Error:

PHP Parse error:  Unclosed '(' in Command line code on line 1
�[31mFailed to run php -r error_reporting(E_ERROR | E_PARSE); define('LARAVEL_START', microtime(true)); require_once '/home/user/project/vendor/autoload.php'; $app = require_once '/home/user/project/bootstrap/app.php'; class VsCodeLaravel extends \Illuminate\Support\ServiceProvider { public function register() { } public function boot() { if (method_exists($this->app['log'], 'setHandlers')) { $this->app['log']->setHandlers([new \Monolog\Handler\ProcessHandler()]); } } } $app->register(new VsCodeLaravel($app)); $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); $kernel->bootstrap(); echo '__VSCODE_LARAVEL_START_OUTPUT__'; echo json_encode([ [ 'key' => 'base_path', 'path' => base_path(), ], [ 'key' => 'resource_path', 'path' => resource_path(), ], [ 'key' => 'config_path', 'path' => config_path(), ], [ 'key' => 'app_path', 'path' => app_path(), ], [ 'key' => 'database_path', 'path' => database_path(), ], [ 'key' => 'lang_path', 'path' => lang_path(), ], [ 'key' => 'public_path', 'path' => public_path(), ], [ 'key' => 'storage_path', 'path' => storage_path(), ], ]); ; echo '__VSCODE_LARAVEL_END_OUTPUT__'; exit(0);: exit status 255�[0m

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions