From: Brion Vibber Date: Wed, 27 Apr 2005 21:26:39 +0000 (+0000) Subject: Regexp in wfQuotedPrintable_name_and_emailaddr is wrong and sometimes fails under... X-Git-Tag: 1.5.0alpha1~103 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=6ae4afa16e107d99936890874fe609b87ecfa1f2;p=lhc%2Fweb%2Fwiklou.git Regexp in wfQuotedPrintable_name_and_emailaddr is wrong and sometimes fails under conditions not fully explored. Should be removed and replaced with cleaner interface, probably. In the meantime, wrapping in a check and adding some debug statements. --- diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 80eb445c72..035e94a1e0 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -54,10 +54,15 @@ require_once( 'WikiError.php' ); function wfQuotedPrintable_name_and_emailaddr( $string ) { /* do not quote printable for email address string , but only for the (leading) string, usually the name */ - preg_match( '/^([^<]*)?(<([A-z0-9_.-]+([A-z0-9_.-]+)*\@[A-z0-9_-]+([A-z0-9_.-]+)*([A-z.]{2,})+)>)?$/', $string, $part ); - if ( !isset($part[1]) ) return $part[2]; - if ( !isset($part[2]) ) return wfQuotedprintable($part[1]); - return wfQuotedprintable($part[1]) . $part[2] ; + if( preg_match( '/^([^<]*)?(<([A-z0-9_.-]+([A-z0-9_.-]+)*\@[A-z0-9_-]+([A-z0-9_.-]+)*([A-z.]{2,})+)>)?$/', $string, $part ) ) { + wfDebug( "wfQuotedPrintable_name_and_emailaddr: '$string' " . serialize( $part ) . "\n" ); + if ( !isset($part[2]) ) return wfQuotedprintable($part[1]); + return wfQuotedprintable($part[1]) . $part[2] ; + } else { + # What have we been given?? + wfDebug( "wfQuotedPrintable_name_and_emailaddr: got confused by '$string'\n" ); + return wfQuotedprintable( $string ); + } } /**