glob_to_pcre generated a warning, I had a look in it ...
just have a deep look at glob_to_pcre, the complete mechanism has to revised ;-)
my solution is:
function glob_to_pcre ($glob) {
// preg_replace cannot handle "\\\\\\2" so convert \\ to \xff
$glob = strtr($glob, "\\", "\xff");
// first convert some unescaped expressions to pcre style: . => \.
$special = ".^$";
$re = preg_replace('/([^\xff])?(['.preg_quote($special).'])/',
"\\1\xff\\2", $glob);
// * => .*, ? => .
$re = preg_replace('/([^\xff])?\*/', '$1.*', $re);
$re = preg_replace('/([^\xff])?\?/', '$1.', $re);
// .*? handled above, now escape the rest
$re = preg_quote($re,'/');
$ret = strtr($re, "\xff", "\\");
return $ret;
}
Logged In: YES
user_id=13755
Originator: NO
You are right. glob_to_pcre is awful and on some email notification pages you get stupid warnings.
I've made a testscript.
", ) as $s) { echo '"', $s, '" => "', glob_to_pcre($s), "\"\n"; } ?>Does this pass without warnings?