Repository navigation
Conversation
Collaborator
Author
|
Sandbox here. https://www.pgdp.org/~bfoley/c.branch/wordcheck_ui_strict/ As an example project, try the ad-hoc word list for https://www.pgdp.org/~bfoley/c.branch/wordcheck_ui_strict/tools/project_manager/edit_project_word_lists.php?projectid=projectID467370f85ad51 If you add 011 and 11 to the adhoc list, you should see only 11 appearing in the results and being in the bad word list for the project. |
srjfoo
approved these changes
Nov 17, 2026
PHP's loose checking means (eg) in_array("011", ["11", "pm"]) => true
As used, this causes incorrect matches (and frequency counts) for
words in particular wordlists.
Just using in_array(strict: true) exposes the sideeffect of appending
spaces to numeric strings (to make them appear non-numeric) to avoid
array_multisort sorting numeric strings differently, so we have
to trim the words_by_freq keys we get back to be able to strictly
compare them against our wordlists.
Unfortunately, these changes can't be unit tested in its current form
as all the UI code outputs using echo.
bpfoley
force-pushed
the
wordcheck_ui_strict
branch
from
November 22, 2026 20:45
ad9561b to
c1c149b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHP's loose checking means (eg) in_array("011", ["11", "pm"]) => true
As used, this causes incorrect matches (and frequency counts) for words in particular wordlists.
Just using in_array(strict: true) exposes the sideeffect of appending spaces to numeric strings (to make them appear non-numeric) to avoid array_multisort sorting numeric strings differently, so we have to trim the words_by_freq keys we get back to be able to strictly compare them against our wordlists.
Unfortunately, these changes can't be unit tested in its current form as all the UI code outputs using echo.