#5571: Fixed URL Validation Rule which didn't check if url had a protocol
-----------------------------------------+----------------------------------
    Reporter:  Lamonte                   |          Type:  Bug   
      Status:  new                       |      Priority:  Medium
   Milestone:  1.2.x.x                   |     Component:  Model 
     Version:  RC3                       |      Severity:  Normal
    Keywords:  url model validation fix  |   Php_version:  PHP 5 
Cake_version:                            |  
-----------------------------------------+----------------------------------
 Essentially this is a bug because URL validation requires a URL protocol,
 without a protocol its not justified as a URL.  Who ever coded this made
 the protocol optional which really isn't, its a "must" in url
 validation.[[BR]][[BR]]



 Old code: (/cake/libs/validation.php)

 {{{
  */
         function url($check) {
                 $_this =& Validation::getInstance();
                 $_this->check = $check;
                 $_this->regex =
 
'/^(?:(?:https?|ftps?|file|news|gopher):\\/\\/)?(?:(?:(?:25[0-5]|2[0-4]\d|(?:(?:1\d)?|[1-9]?)\d)\.){3}(?:25[0-5]|2[0-4]\d|(?:(?:1\d)?|[1-9]?)\d)'
                                                         .
 
'|(?:[0-9a-z]{1}[0-9a-z\\-]*\\.)*(?:[0-9a-z]{1}[0-9a-z\\-]{0,62})\\.(?:[a-z]{2,6}|[a-z]{2}\\.[a-z]{2,6})'
                                                         .
 '(?::[0-9]{1,4})?)(?:\\/?|\\/[\\w\\-\\.,\'@?^=%&:;\/[EMAIL 
PROTECTED]&\/~\\+#])$/i';
                 return $_this->_check();
         }
 }}}

 New code:

 {{{
  */
         function url($check) {
                 $_this =& Validation::getInstance();
                 $_this->check = $check;
                 $_this->regex =
 
'/^(?:(?:https?|ftps?|file|news|gopher):\\/\\/)(?:(?:(?:25[0-5]|2[0-4]\d|(?:(?:1\d)?|[1-9]?)\d)\.){3}(?:25[0-5]|2[0-4]\d|(?:(?:1\d)?|[1-9]?)\d)'
                                                         .
 
'|(?:[0-9a-z]{1}[0-9a-z\\-]*\\.)*(?:[0-9a-z]{1}[0-9a-z\\-]{0,62})\\.(?:[a-z]{2,6}|[a-z]{2}\\.[a-z]{2,6})'
                                                         .
 '(?::[0-9]{1,4})?)(?:\\/?|\\/[\\w\\-\\.,\'@?^=%&:;\/[EMAIL 
PROTECTED]&\/~\\+#])$/i';
                 return $_this->_check();
         }
 }}}

 Simple solution, should be fixed in final release.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5571>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to