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

Fix dictionary for strip_tags #8729

Merged
merged 3 commits into from Nov 23, 2022

Conversation

alies-dev
Copy link
Contributor

@alies-dev alies-dev commented Nov 21, 2022

Changes:

  • allow null for 2nd parameter $allowed_tags from PHP 8.0 (see docs)
  • allow array for 2nd parameter $allowed_tags from PHP 7.4 (see docs)

Proofs:

@alies-dev alies-dev changed the base branch from master to 4.x November 21, 2022 22:35
@@ -45,6 +45,10 @@
'old' => ['resource|false', 'command'=>'string', 'descriptor_spec'=>'array', '&pipes'=>'resource[]', 'cwd='=>'?string', 'env_vars='=>'?array', 'options='=>'?array'],
'new' => ['resource|false', 'command'=>'string|array', 'descriptor_spec'=>'array', '&pipes'=>'resource[]', 'cwd='=>'?string', 'env_vars='=>'?array', 'options='=>'?array'],
],
'strip_tags' => [
'old' => ['string', 'string'=>'string', 'allowed_tags='=>'?string'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, null was not accepted prior to PHP 8.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also found this information in documentation. But I also checked on PHP 7.2 - it also works with null: https://3v4l.org/nkHYY#v7.2.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but that's because of undefined behaviour. Just because it used to work doesn't mean that it was designed like that or that it should be used this way.
Arrays worked too https://3v4l.org/PE5hP#v7.2.0 and so did booleans https://3v4l.org/qoDFT#v7.2.0
Even with strict types, you could pass anything you'd like https://3v4l.org/mJvL3#v7.2.0 That's why in PHP 8.0 and 8.1 this behaviour was fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kamil-tekiela
thanks a lot, should be fixed by d33c338

@orklah
Copy link
Collaborator

orklah commented Nov 22, 2022

Thanks for that! Two changes:

  • Could you target master branch please? We're very close to releasing the next Psalm version and it will be a part of it
  • Callmap.php should also be changed to reflect the most up to date signature

@alies-dev alies-dev changed the base branch from 4.x to master November 22, 2022 22:43
@alies-dev
Copy link
Contributor Author

@orklah

We're very close to releasing the next Psalm version and it will be a part of it

that's great news! Are you going to merge changed from 4.x to 5.x (made after 5.x branch off)?

Could you target master branch please? We're very close to releasing the next Psalm version and it will be a part of it

done

Callmap.php should also be changed to reflect the most up to date signature

done

@orklah
Copy link
Collaborator

orklah commented Nov 23, 2022

that's great news! Are you going to merge changed from 4.x to 5.x (made after 5.x branch off)?

If I'm not mistaken, we did already :) The only thing left to do would be to make a (last?) release from 4.x because some PR were merged after the latest release. We can do that even after a Psalm 5 release though so no emergency!

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Nov 23, 2022
@orklah
Copy link
Collaborator

orklah commented Nov 23, 2022

Thanks!

@orklah orklah merged commit e83ac65 into vimeo:master Nov 23, 2022
@alies-dev
Copy link
Contributor Author

@orklah
How about a new tag on master branch then? A new beta or even RC will be great before a major release.

@alies-dev alies-dev deleted the fix-dictionary-for-strip_tags-function branch November 23, 2022 12:29
@orklah
Copy link
Collaborator

orklah commented Nov 23, 2022

I made one. We should have released a few days ago already so I didn't bother but as we took some more time, We might as well make one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants