Development

Changeset 8720

You must first sign up to be able to contribute.

Changeset 8720

Show
Ignore:
Timestamp:
05/02/08 12:07:15 (4 months ago)
Author:
FabianLange
Message:

fixed url validation bug by applied carls patch (1.1 backport). fixes #1373

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/validator/sfUrlValidator.class.php

    r3345 r8720  
    2929  public function execute(&$value, &$error) 
    3030  { 
    31     $re = '/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)/i'; 
    32  
     31    $re = '~^ 
     32      (https?|ftp)://                         # http or https or ftp 
     33      ( 
     34        ([a-z0-9-]+\.)+[a-z]{2,6}             # a domain name 
     35          |                                   #  or 
     36        \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}    # a IP address 
     37      ) 
     38      (:[0-9]+)?                              # a port (optional) 
     39      (/?|/\S+)                               # a /, nothing or a / with something 
     40    $~ix'; 
    3341    if (!preg_match($re, $value)) 
    3442    { 
  • branches/1.0/test/unit/validator/sfUrlValidatorTest.php

    r3346 r8720  
    1212require_once($_test_dir.'/unit/sfContextMock.class.php'); 
    1313 
    14 $t = new lime_test(12, new lime_output_color()); 
     14$t = new lime_test(22, new lime_output_color()); 
    1515 
    1616$context = new sfContext(); 
     
    2626  'http://www.symfony-project.com/', 
    2727  'ftp://www.symfony-project.com/file.tgz', 
     28  'http://www.google.com:8080',  
     29  'http://192.168.1.1',  
    2830); 
    2931 
     
    3133  'google.com', 
    3234  'http:/google.com', 
     35  'http://www.symfony-project,com/',  
     36  'http://www.symfony-project@com',  
     37  'http://www.symfony-project@com foobar',  
    3338); 
    3439