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

Add documentation for the Spoofchecker::setRestrictionLevel method #2792

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alamirault
Copy link

Hi,

This PR try to document Spoofchecker::setRestrictionLevel

php-src commit is php/php-src@f56ceb7

It's my first contribution on this repository, tell me if something is wrong 😄

@@ -308,6 +308,7 @@
<function name="spoofchecker::issuspicious" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8, PECL intl &gt;= 2.0.0"/>
<function name="spoofchecker::setallowedlocales" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8, PECL intl &gt;= 2.0.0"/>
<function name="spoofchecker::setchecks" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8, PECL intl &gt;= 2.0.0"/>
<function name="spoofchecker::setrestrictionlevel" from="PHP 7 &gt;= 7.3, PHP 8, PECL intl &gt;= 2.0.0"/>
Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure for PECL intl &gt;= 2.0.0, where can I know that ?

Copy link
Member

Choose a reason for hiding this comment

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

You could check the https://github.com/cataphract/PECL-intl source code.

But this is not going to be present in the PECL version, as it has been bundled for a while.

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

One possible gotcha that should probably be mentioned is this one: https://github.com/WoltLab/WCF/blob/372e52a4a91eab9872c395d4ed42eaea1d790410/wcfsetup/install/files/lib/system/event/listener/UsernameValidatingCheckCharactersListener.class.php#L48-L55

Calling ->setChecks() after ->setRestrictionLevel() nullifies the restriction level.

(I hope to propose a cleaner API if / when PHP has tagged unions)

@alamirault
Copy link
Author

@TimWolla Do you know where I can found an example of a warning/mention in phpdoc ? I don't know how to add it

@TimWolla
Copy link
Member

@alamirault

<caution>
<para>
Using the <constant>PASSWORD_BCRYPT</constant> as the
algorithm, will result
in the <parameter>password</parameter> parameter being truncated to a
maximum length of 72 bytes.
</para>
</caution>

<warning>
<para>
The salt option is deprecated. It is now
preferred to simply use the salt that is generated by default.
As of PHP 8.0.0, an explicitly given salt is ignored.
</para>
</warning>

See: https://www.php.net/manual/en/function.password-hash.php

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

Successfully merging this pull request may close these issues.

3 participants