Skip to content

[Bug]: Generated PHP Files Emit Deprecated/Warn Errors that Break the Plugin #489

@dac514

Description

@dac514

Extension Version

1.2.1

PHP Binary

Sail

Operating System

Linux

What happened?

I'm encountering issues similar to #485, where the plugin fails to parse PHP files it generates itself. The failures seem related to deprecated messages and warnings from third-party packages that end up appearing in the plugin output and cause it to break.

Environment Details

  • PHP Version: 8.4.14 CLI
  • PHP INI settings:
    • display_errors = Off
    • log_errors = On
    • error_log = <not set> (defaults to SAPI error logger → stderr in CLI)

Steps to Reproduce

  1. Use the plugin to generate a PHP file (e.g., _laravel_ide/discover-*.php).
  2. Look at VS Code error logs.

Observed Output

When plugin/php runs the generated files, output is polluted by deprecated messages like:

2025-11-16 15:19:01.567 [error] "/usr/bin/php" "/home/dac/code/github/my/project/vendor/_laravel_ide/discover-739c51cbd2b78369222c3575c94c5ee8.php"
2025-11-16 15:19:01.567 [error] Translations
PHP Deprecated: Osiset\ShopifyApp\Util::parseQueryString(): Implicitly marking parameter $delimiter as nullable is deprecated, the explicit nullable type must be used instead in /home/dac/code/github/my/project/vendor/kyon147/laravel-shopify/src/Util.php on line 68

Even though these messages are non-fatal and come from third-party code (outside my control), they disrupt plugin.

Investigation

I think the discover files are generated from these template files:

At the top of these PHP templates, error_reporting(E_ERROR | E_PARSE); is set, which controls what is shown by display_errors but does not affect log_errors.

Since PHP CLI logs are sent to stderr (unlike web server configurations such as Apache, where logs are typically written to a file), this behavior can make the plugin brittle and more susceptible to issues caused by noisy output.

Running the generated file like:
/usr/bin/php "/home/dac/code/github/my/project/vendor/_laravel_ide/discover-739c51cbd2b78369222c3575c94c5ee8.php" 2>/dev/null
prevents these non-critical messages from appearing in the output. Not sure if that's a solution, just giving an example with 2>/dev/null

Maybe another solution is to manually set error_log to some path but that's not the PHP CLI default in most distros, Dockerfiles, it's a cumbersome step.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions