Skip to content

Uncaught RuntimeException after changing the $config global in an autoloader #5359

@MauricioFauth

Description

@MauricioFauth

When registering a custom autoloader with the following code, Psalm will crash due to an uncaught RuntimeException when writing error baseline to file.

<?php
$GLOBALS['config'] = null;
vendor/bin/psalm --set-baseline=baseline.xml
Uncaught RuntimeException: PHP Error: Trying to get property 'include_php_versions_in_error_baseline' of non-object in vendor/vimeo/psalm/src/psalm.php:711 in vendor/vimeo/psalm/src/Psalm/Internal/ErrorHandler.php:66
Stack trace:
#0 vendor/vimeo/psalm/src/psalm.php(711): Psalm\Internal\ErrorHandler::Psalm\Internal\{closure}()
#1 vendor/vimeo/psalm/psalm(2): require_once('/home/...')
#2 {main}
(Psalm dev-master@3c66b755e2468b0976979768972d298f4ba25651 crashed due to an uncaught Throwable)

PHP 7.4.15.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions