laminas / laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria
https://docs.laminas.dev/laminas-validator/
BSD 3-Clause "New" or "Revised" License
126 stars 55 forks source link

[RFC]: Deprecate and remove the `Upload` validator #347

Closed gsteel closed 2 months ago

gsteel commented 2 months ago

RFC

Q A
Proposed Version(s) 3.0.0
BC Break? Yes

Goal

Remove seeimingly unnecessary validator

Background

There are 2 validators for validating successful upload:

UploadFile accepts a value to isValid representing a single file and returns true when the file appears to be successfully uploaded.

Upload requires a list of all uploaded files to its constructor, and subsequent calls to isValid represent the form element name/key it seems. i.e. isValid('myfile')

It seems odd that Upload needs the input as an argument to its constructor (Or option) rather than to the isValid method.

Considerations

I might be missing the point of the Upload validator. It looks like something from the days of Laminas\File\Transfer and Laminas\Http.

If anyone can shed any light on why it works the way it does, I'm all ears.

Proposal(s)

Deprecate the validator in 2.61.0 and remove it in 3.0.0

cc @laminas/technical-steering-committee

Edit: The Upload validator works directly with the $_FILES super-global šŸ¤¢

froschdesign commented 2 months ago

@weierophinney

Considerations

I might be missing the point of the Upload validator. It looks like something from the days of Laminas\File\Transfer and Laminas\Http.

If anyone can shed any light on why it works the way it does, I'm all ears.

Do you have a comment on this?

gsteel commented 2 months ago

Closed via #362