Skip to content
Extraits de code Groupes Projets
Valider 841de17e rédigé par esj's avatar esj
Parcourir les fichiers

Protéger le caractère / dans une RegExp définie dynamiquement.

parent f648fa5a
Branches
Étiquettes
Aucune requête de fusion associée trouvée
...@@ -132,8 +132,7 @@ function recherche_en_base($recherche='', $tables=NULL, $options=array(), $serve ...@@ -132,8 +132,7 @@ function recherche_en_base($recherche='', $tables=NULL, $options=array(), $serve
if (!strlen($recherche)) if (!strlen($recherche))
return array(); return array();
$preg = '/'.$recherche.'/' . $options['preg_flags']; $preg = '/'.str_replace('/', '\\/', $recherche).'/' . $options['preg_flags'];
// Si la chaine est inactive, on va utiliser LIKE pour aller plus vite // Si la chaine est inactive, on va utiliser LIKE pour aller plus vite
// ou si l'expression reguliere est invalide // ou si l'expression reguliere est invalide
if (preg_quote($recherche, '/') == $recherche if (preg_quote($recherche, '/') == $recherche
...@@ -294,7 +293,7 @@ function remplace_en_base($recherche='', $remplace=NULL, $tables=NULL, $options= ...@@ -294,7 +293,7 @@ function remplace_en_base($recherche='', $remplace=NULL, $tables=NULL, $options=
$results = recherche_en_base($recherche, $tables, $options); $results = recherche_en_base($recherche, $tables, $options);
$preg = '/'.$recherche.'/' . $options['preg_flags']; $preg = '/'.str_replace('/', '\\/', $recherche).'/' . $options['preg_flags'];
foreach ($results as $table => $r) { foreach ($results as $table => $r) {
$_id_table = id_table_objet($table); $_id_table = id_table_objet($table);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter