Skip to content

[Bug]: [error] /bin/sh: <line_no>: Syntax error: ")" unexpected #488

@eecurfew

Description

@eecurfew

Extension Version

1.2.1

PHP Binary

Docker

Operating System

Linux

What happened?

2025-11-12 15:40:33.648 [info] Activating Laravel Extension...
2025-11-12 15:40:33.648 [info] Started
2025-11-12 15:40:39.023 [error] /bin/sh: 104: Syntax error: ")" unexpected

2025-11-12 15:41:13.064 [error] /bin/sh: 262: Syntax error: ")" unexpected

The error is triggered the first time (of VS Code session) I open either of these files:

  • app/helpers.php
  • vendor/_laravel_ide/discover-<hash>.php (only one of them)
    This is obviously not a file I would normally open, but I found out during debugging.

I noticed that the error line /bin/sh: <line_no> comports to similar code in both PHP files:

  • Line 104 of vendor/_laravel_ide/discover-<hash>.php:

    return str($modelProperty->getValue($provider))->prepend("\\")->toString();
  • Line 262 of app/helpers.php:

    $className = trim($target, "\\");

So, I expect the problem is related to "\\" in the PHP file not working well with /bin/sh, presumably something is escaping incorrectly...?

Anyway, for app/helpers.php, replacing "\\" with '\\', fixes the issue.

PS: Not sure what OS to pick; I run Laravel using Docker on Ubuntu on WSL2 (not Docker Desktop).

Mimimal Code Sample

$foo = trim($bar, "\\");

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions