From b262ec547fdd4daeecf49d922c9b5447fd1650d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Oct 2008 19:44:30 +0000 Subject: [PATCH] Fix: http://matelli.fr/showcases/patchs-dolibarr/fix-cleaning-url.html --- htdocs/lib/functions.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 79978bdf697..434f914e9e8 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -2481,7 +2481,10 @@ function measuring_units_string($unit,$measuring_style='') */ function clean_url($url,$http=1) { - if (eregi('^(https?:[\\\/]+)?([0-9A-Z\-\.]+\.[A-Z]{2,4})(:[0-9]+)?',$url,$regs)) + // Fixed by Matelli (see http://matelli.fr/showcases/patchs-dolibarr/fix-cleaning-url.html) + // To include the minus sign in a char class, we must not escape it but put it at the end of the class + // Also, there's no need of escape a dot sign in a class + if (eregi('^(https?:[\\\/]+)?([0-9A-Z.-]+\.[A-Z]{2,4})(:[0-9]+)?',$url,$regs)) { $proto=$regs[1]; $domain=$regs[2];