Skip to content

PHP _dependency_capture captures multi-line code blocks as import tokens #3609

Closed

Description

@squid-protocol

Problem

PHP's _dependency_capture records whole stretches of code as "import" tokens. From the language-crucible golden master, Extracted Dependencies:

  • php/wordpress/functions.php: "$message = '' ) \n\n\t/**\n\t * Fires when a deprecated file is called.\n\t * … do_action( 'deprecated_file_included'"
  • php/wordpress/admin-ajax.php: "a valid action parameter.\nif ( empty( $_REQUEST['action'] ) || … wp_die( '0'"
  • php/symfony/Router.php: "'debug' => false", "'matcher_class' => CompiledUrlMatcher::class"
  • php/laravel_core/BladeCompiler.php: "$alias = null)\n \n $alias = $alias ?: Arr::last(explode('.'"

The capture seems to start at an include/require/use-like word inside a comment or identifier (_doing_it_wrong, aliasInclude, "file that should have been included") and run to the next ;.

Impact

The junk tokens feed the supply-chain firewall (imports_unknown), the typosquat radar and the import graph. They also make any change to the comma/brace splitting ripple through PHP golden masters; #3595 had to guard against exactly that.

Fix direction

Anchor the capture to statement position (include/require/include_once/require_once/use as a whole word at statement start, or after ;/{/}) and bound the captured expression to one line. Check import_graph_accuracy.py php (guzzle: 99.0/100 today) and the golden-master scope.

Activity

  1. added
    bug
    core-engine
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions