This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
Numeric parsing: ensure params array is correctly indexed with no missing keys #25
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.
Due to the way
explode()
is used in params parsing for numeric, the$parsed['params']
array is currently 1-indexed rather than 0-indexed.In addition, if an empty param is filtered out, it leaves a "hole" in the index sequence.
ie.
:server.name 001 Phergie3 :Welcome to the network
becomes:and
:server.name 005 Phergie3 CHANMODES=b,k,l,nt TOPICLEN=30 :are supported by this server
becomes:This changeset re-indexes the params array to ensure the array keys are always sequential integers beginning at 0. With it, the second example above becomes:
Comments needed, as this is a breaking change for any plugin that uses a parameter at a specific index when parsing a numeric. This was also the case with #14, and at the time, the plugins known to be affected were UserMode and OpsWorksDeployment.