Skip to content

Tracing JIT triggers wrong Array to string conversion in Psalm #12255

Closed as not planned
@danog

Description

@danog

Description

Running the following command inside of https://github.com/vimeo/psalm/ @ 7428e49b115a2a837aa29cf0fafd0ca902fe2457, only when tracing JIT is enabled with the config specified in #12250, triggers an Array to string conversion error in a place that makes no sense:

PSALM_ALLOW_XDEBUG=1 ./psalm --no-cache --threads=1

Result:

░░░░░░░Uncaught RuntimeException: PHP Error: Array to string conversion in /home/daniil/repos/psalm/src/Psalm/Type/Atomic/TGenericObject.php:79 for command with CLI args "./psalm --no-cache --threads=1" in /home/daniil/repos/psalm/src/Psalm/Internal/ErrorHandler.php:75

The line that triggers the issue:

        return $this->value . '<' . substr($s, 0, -2) . '>' . $extra_types;

The code around it:

    public function getKey(bool $include_extra = true): string
    {
        $s = '';

        foreach ($this->type_params as $type_param) {
            $s .= $type_param->getKey() . ', ';
        }

        $extra_types = '';

        if ($include_extra && $this->extra_types) {
            $extra_types = '&' . implode('&', $this->extra_types);
        }

        return $this->value . '<' . substr($s, 0, -2) . '>' . $extra_types;
    }

PHP Version

PHP 8.2.10

Operating System

Arch linux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions