Hello, I have the following function to return a clean path for a script.
function cleanPath($path) {
$path = (string) $path;
$path = preg_replace(
array(
'#[\n\r\t\0]*#im',
'#/(\.){1,}/#i',
'#(\.){2,}#i',
'#(\.){2,}#i',
'#('.DIRECTORY_SEPARATOR.'){2,}#i'
),
array(
'',
'',
'',
'/'
),
$path
)
;
return rtrim($path,DIRECTORY_SEPARATOR);
}
PHP gives the error:
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing ) at offset 7 in C:\wamp\www\extlogin\app\ni\inc\classes\cfiletree.php on line 18
Any ideas about what's wrong and how to fix it?
Thank you.