J'ai la fonction suivante pour retourner un chemin propre pour un script.PHP preg_replace() compilation a échoué: manquant)
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 donne l'erreur:
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
Toutes les idées sur ce qui ne va pas et comment y remédier?
Merci.
Existe-t-il un moyen d'intercepter cette erreur particulière, c'est-à-dire que vous pouvez "tester" un modèle avant de l'utiliser? –