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

Don't support changes in strip_tags from php 7.4 #4317

Closed
lompi opened this issue Oct 13, 2020 · 7 comments · Fixed by #10122
Closed

Don't support changes in strip_tags from php 7.4 #4317

lompi opened this issue Oct 13, 2020 · 7 comments · Fixed by #10122

Comments

@lompi
Copy link

lompi commented Oct 13, 2020

From php 7.4 as second argument is possible to use array- psalm see that as error.

https://psalm.dev/r/6dca71d4dc

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/6dca71d4dc
<?php

echo strip_tags('<h1>header</h1>', ['<h1>']);
Psalm output (using commit bb7d713):

ERROR: InvalidArgument - 3:36 - Argument 2 of strip_tags expects null|string, array{string(<h1>)} provided

@weirdan weirdan added bug easy problems Issues that can be fixed without background knowledge of Psalm labels Oct 13, 2020
@orklah
Copy link
Collaborator

orklah commented Oct 14, 2020

@weirdan strip_tags is present in CoreGenericsFunctions.phpstub . Is there a way to tell psalm the second parameter is an array only from PHP 7.4 in there? Maybe the CallMap_74_Delta is enough? It's still blury for me how Psalm behaves when a function has more than one description

@weirdan
Copy link
Collaborator

weirdan commented Oct 14, 2020

That's a very good question. I don't know.

@weirdan weirdan removed the easy problems Issues that can be fixed without background knowledge of Psalm label Oct 14, 2020
@othercorey
Copy link
Contributor

If this is CoreGenericFunctions, does adding it to a versioned stub override this file or is this file assumed to be latest?

@orklah
Copy link
Collaborator

orklah commented Feb 6, 2023

I'm not really sure, we may need to test that

@jawira
Copy link

jawira commented Jul 7, 2023

Hi, I'm still having this false-positive.

Argument 2 of strip_tags expects null|string, but array<array-key, string> provided (see https://psalm.dev/004)

PHP 8.0.28
Psalm 5.13.1@086b94371304750d1c673315321a55d15fc59015

There's something I can do to fix this ? Thanks.

@weirdan
Copy link
Collaborator

weirdan commented Aug 17, 2023

Versioned stubs do indeed override things in CoreGenericFunctions.

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.

5 participants