Skip to content

Windows Laravel export can yield empty artifacts and absolute paths #814

@levnikolaevich

Description

@levnikolaevich

Summary

Running scip-php on a real Laravel project on Windows exposed three related issues in the current runtime path:

  1. Composer autoload paths that end with / are only trimmed with DIRECTORY_SEPARATOR, so Windows projects can end up with projectFiles() === 0 and an empty index.scip.
  2. When scip-php runs outside the target project's own vendor/, it can leave the target project's autoloader registered and accidentally mix the target app's nikic/php-parser with the indexer's own dependencies.
  3. relative_path generation assumes / separators, so Windows artifacts can emit absolute paths instead of project-relative paths.

Repro

On a Laravel project on Windows:

  • a global scip-php run initially produced an empty index.scip
  • after fixing the path trimming issue, the run crashed inside PhpParser\\Node\\Expr\\Cast\\Int_::KIND_INT because the target project autoloader was still active and a different nikic/php-parser was loaded
  • after isolating the autoloader, the produced artifact still emitted absolute Windows paths as relative_path

Expected

  • projectFiles() should find the project's PHP files regardless of slash style in Composer metadata
  • the indexer should keep using its own runtime dependencies even when it indexes a different project's vendor/
  • emitted relative_path values should stay relative on Windows too

Notes

I have a minimal fix for all three in a downstream branch and can open a PR immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions