Changeset 8720
- Timestamp:
- 05/02/08 12:07:15 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/validator/sfUrlValidator.class.php
r3345 r8720 29 29 public function execute(&$value, &$error) 30 30 { 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'; 33 41 if (!preg_match($re, $value)) 34 42 { branches/1.0/test/unit/validator/sfUrlValidatorTest.php
r3346 r8720 12 12 require_once($_test_dir.'/unit/sfContextMock.class.php'); 13 13 14 $t = new lime_test( 12, new lime_output_color());14 $t = new lime_test(22, new lime_output_color()); 15 15 16 16 $context = new sfContext(); … … 26 26 'http://www.symfony-project.com/', 27 27 'ftp://www.symfony-project.com/file.tgz', 28 'http://www.google.com:8080', 29 'http://192.168.1.1', 28 30 ); 29 31 … … 31 33 'google.com', 32 34 'http:/google.com', 35 'http://www.symfony-project,com/', 36 'http://www.symfony-project@com', 37 'http://www.symfony-project@com foobar', 33 38 ); 34 39