ZF-11745: In Zend_ValidateEmailAddress, make certain 'private' functions 'protected' so that they can be overridden when the class is extended, and store $mxHosts as a class protected variable
Description
Make the following functions 'protected' rather than 'private' so that they can be extended or overridden: o _isReserved(), _toIp(), _validateLocalPart(), _validateMXRecords(), _validateHostnamePart()
Modify _validateMXRecords() to: o get the mx weighting information as well o sort the list of $mxhosts by desc weight order o store the resultant array as a protected variable at class level
Separate out the logic that splits the email into a separate public function that stores the results in the class variables as now.
This will make the class more useful when being extended, and also allow other code to obtain the benefit of the sorted mxhosts array, and the email split functionality
Comments
Posted by Thomas Weidner (thomas) on 2011-09-15T20:54:14.000+0000
Why should the validate method being extended? There is no benefit in having this additional informations, and sorting them internally. The validator looks only if there is ONE matching record. For the match itself it is useless if there is a sorting or not.
Posted by Rob McClean (romac) on 2011-09-16T09:29:17.000+0000
Posted by Thomas Weidner (thomas) on 2011-09-16T12:22:29.000+0000
Nope, I did not disagree to make it protected nor did I ask why you want to extend it. But I asked why additional informations should be taken in account in the existing validation when they are not used internally. I see no reason to extend the implementation, get informations which are not used and store them internally so that others can extend the class based on not used informations.
Posted by Rob McClean (romac) on 2011-09-16T15:05:09.000+0000
OK, no problem, thanks. It was just an idea. (p.s. I'm a newbie to Zend and this Issue tracker. Sorry if I've commented inappropriately)
Posted by Thomas Weidner (thomas) on 2011-10-03T18:34:15.000+0000
Added within ZF2 with GH-452