Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Exception: Error Call to undefined function str_contains() #7219

Closed
voku opened this issue Dec 26, 2021 · 1 comment · Fixed by #7220
Closed

Uncaught Exception: Error Call to undefined function str_contains() #7219

voku opened this issue Dec 26, 2021 · 1 comment · Fixed by #7220
Assignees

Comments

@voku
Copy link
Contributor

voku commented Dec 26, 2021

vesion: 4.16.0

example:

Whenever I change the "errorLevel" and try to re-run psalm I see this error via e.g. php 7.4. It's working with php >= 8.0 and if I once ran it with >= 8.0, then I can also run it with e.g. php 7.4 again.

error:

Uncaught Exception: Error Call to undefined function str_contains() Emitted in phar:///psalm.phar/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php:274 Stack trace in the forked worker: #0 phar:///psalm.phar/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php(264): Psalm\Internal\Provider\ReturnTypeProvider\ArrayMapReturnTypeProvider::cleanContext() #1 phar:///psalm.phar/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php(114): Psalm\Internal\Provider\ReturnTypeProvider\ArrayMapReturnTypeProvider::getReturnTypeFromMappingIds() #2 phar:///psalm.phar/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php(164): Psalm\Internal\Provider\ReturnTypeProvider\ArrayMapReturnTypeProvider::getFunctionReturnType() #3 phar:///psalm.phar/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php(76): Psalm\Internal\Provider\FunctionReturnTypeProvider->getReturnType() #4 phar:///psalm.phar/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php(139): Psalm\Internal\Analyzer\Statements\Expression\Call\FunctionCallReturnTypeFetcher::fetch() #5 phar:///psalm.phar/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(175): Psalm\Internal\Analyzer\Statements\Expression\Call\FunctionCallAnalyzer::analyze() #6 phar:///psalm.phar/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(68): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression() #7 phar:///psalm.phar/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php(165): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze() #8 phar:///psalm.phar/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(98): Psalm\Internal\Analyzer\Statements\Expression\AssignmentAnalyzer::analyze() #9 phar:///psalm.phar/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(68): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression() #10 phar:///psalm.phar/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(390): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze() #11 phar:///psalm.phar/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(179): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement() #12 phar:///psalm.phar/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php(288): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze() #13 phar:///psalm.phar/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(824): Psalm\Internal\Analyzer\FunctionLikeAnalyzer->analyze() #14 phar:///psalm.phar/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(245): Psalm\Internal\Analyzer\ClassAnalyzer->analyzeClassMethod() #15 phar:///psalm.phar/src/Psalm/Internal/Analyzer/FileAnalyzer.php(184): Psalm\Internal\Analyzer\ClassAnalyzer->analyze() #16 phar:///psalm.phar/src/Psalm/Internal/Codebase/Analyzer.php(286): Psalm\Internal\Analyzer\FileAnalyzer->analyze() #17 phar:///psalm.phar/src/Psalm/Internal/Fork/Pool.php(163): Psalm\Internal\Codebase\Analyzer->Psalm\Internal\Codebase\{closure}() #18 phar:///psalm.phar/src/Psalm/Internal/Codebase/Analyzer.php(333): Psalm\Internal\Fork\Pool->__construct() #19 phar:///psalm.phar/src/Psalm/Internal/Codebase/Analyzer.php(241): Psalm\Internal\Codebase\Analyzer->doAnalysis() #20 phar:///psalm.phar/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(482): Psalm\Internal\Codebase\Analyzer->analyzeFiles() #21 phar:///psalm.phar/src/Psalm/Internal/Cli/Psalm.php(274): Psalm\Internal\Analyzer\ProjectAnalyzer->check() #22 phar:///psalm.phar/psalm(6): Psalm\Internal\Cli\Psalm::run() #23 /psalm.phar(14): require('phar:///home/lm...') #24 {main} in phar:///psalm.phar/src/Psalm/Internal/Fork/Pool.php:320 Stack trace: #0 phar:///psalm.phar/src/Psalm/Internal/Fork/Pool.php(350): Psalm\Internal\Fork\Pool->readResultsFromChildren() #1 phar:///psalm.phar/src/Psalm/Internal/Codebase/Analyzer.php(371): Psalm\Internal\Fork\Pool->wait() #2 phar:///psalm.phar/src/Psalm/Internal/Codebase/Analyzer.php(241): Psalm\Internal\Codebase\Analyzer->doAnalysis() #3 phar:///psalm.phar/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(482): Psalm\Internal\Codebase\Analyzer->analyzeFiles() #4 phar:///psalm.phar/src/Psalm/Internal/Cli/Psalm.php(274): Psalm\Internal\Analyzer\ProjectAnalyzer->check() #5 phar:///psalm.phar/psalm(6): Psalm\Internal\Cli\Psalm::run() #6 /psalm.phar(14): require('phar:///home/lm...') #7 {main} (Psalm 4.x-dev@ crashed due to an uncaught Throwable)

@voku voku changed the title 4.16.0: Uncaught Exception: Error Call to undefined function str_contains() Uncaught Exception: Error Call to undefined function str_contains() Dec 26, 2021
@weirdan weirdan self-assigned this Dec 26, 2021
weirdan added a commit to weirdan/psalm that referenced this issue Dec 26, 2021
Fixes vimeo#7219 (str_contains was added in PHP 8)
@weirdan
Copy link
Collaborator

weirdan commented Dec 26, 2021

Fixed in 4.16.1 (you may need to wait a little for the phar to be built).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants