<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/taint.detail.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'taint.detail.basic.php',
    1 => 'Comment la marque de corruption se propage',
    2 => 'Comment la marque de corruption se propage',
  ),
  'up' => 
  array (
    0 => 'taint.detail.php',
    1 => 'Propagation et v&eacute;rifications',
  ),
  'prev' => 
  array (
    0 => 'taint.detail.php',
    1 => 'Propagation et v&eacute;rifications',
  ),
  'next' => 
  array (
    0 => 'taint.detail.sinks.php',
    1 => 'O&ugrave; taint d&eacute;clenche des avertissements',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/taint/detail.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="taint.detail.basic" class="section">
  <h2 class="title">Comment la marque de corruption se propage</h2>
  <p class="simpara">
   La marque de corruption est un bit unique stocké sur la chaîne elle-même,
   pas sur la variable qui la contient. Assigner, passer ou partager une
   chaîne corrompue conserve la marque. La concaténation et l&#039;interpolation
   de chaînes la propagent également :
  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Opérateurs qui propagent la marque de corruption</strong></caption>
    
     <tbody class="tbody">
      <tr>
       <td><code class="literal">=</code> (assignement, y compris <code class="literal">list()</code>/<code class="literal">déstructuration de tableau</code>)</td>
      </tr>

      <tr>
       <td><code class="literal">.</code> (concaténation)</td>
      </tr>

      <tr>
       <td><code class="literal">.=</code> (assignement de concaténation)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;{$var}&quot;</code> (interpolation de chaîne, y compris le chemin rapide <code class="literal">ROPE</code>)</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="simpara">
   De plus, taint comprend un ensemble fixe de fonctions de chaînes : lorsque
   l&#039;un des arguments de chaîne concernés est corrompu, la chaîne retournée
   est également marquée comme corrompue. L&#039;appel normal et, sur PHP 8.4+,
   l&#039;appel rapide sans cadre (frameless) sont tous deux couverts.
  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Fonctions qui propagent la marque de corruption</strong></caption>
    
     <tbody class="tbody">
      <tr>
       <td><span class="function"><a href="function.trim.php" class="function">trim()</a></span>, <span class="function"><a href="function.rtrim.php" class="function">rtrim()</a></span>, <span class="function"><a href="function.ltrim.php" class="function">ltrim()</a></span></td>
      </tr>

      <tr>
       <td><span class="function"><a href="function.substr.php" class="function">substr()</a></span>, <span class="function"><a href="function.strstr.php" class="function">strstr()</a></span></td>
      </tr>

      <tr>
       <td><span class="function"><a href="function.str-replace.php" class="function">str_replace()</a></span>, <span class="function"><a href="function.str-ireplace.php" class="function">str_ireplace()</a></span></td>
      </tr>

      <tr>
       <td><span class="function"><a href="function.str-pad.php" class="function">str_pad()</a></span>, <span class="function"><a href="function.strtolower.php" class="function">strtolower()</a></span>, <span class="function"><a href="function.strtoupper.php" class="function">strtoupper()</a></span>, <span class="function"><a href="function.strval.php" class="function">strval()</a></span></td>
      </tr>

      <tr>
       <td><span class="function"><a href="function.explode.php" class="function">explode()</a></span> (chaque élément du tableau résultant)</td>
      </tr>

      <tr>
       <td><span class="function"><a href="function.implode.php" class="function">implode()</a></span>/<span class="function"><a href="function.join.php" class="function">join()</a></span> (un séparateur corrompu corrompt également le résultat)</td>
      </tr>

      <tr>
       <td><span class="function"><a href="function.sprintf.php" class="function">sprintf()</a></span>, <span class="function"><a href="function.vsprintf.php" class="function">vsprintf()</a></span> (seul le spécificateur <code class="literal">%s</code> transporte la marque ; <code class="literal">sprintf(&quot;%d&quot;, $t)</code> retourne une chaîne propre)</td>
      </tr>

      <tr>
       <td><span class="function"><a href="function.dirname.php" class="function">dirname()</a></span>, <span class="function"><a href="function.basename.php" class="function">basename()</a></span>, <span class="function"><a href="function.pathinfo.php" class="function">pathinfo()</a></span></td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="simpara">
   Toute fonction que taint ne comprend pas explicitement retourne une
   chaîne neuve et non marquée -- y compris les fonctions d&#039;échappement
   telles que <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>,
   <span class="function"><a href="function.htmlentities.php" class="function">htmlentities()</a></span> ou
   <span class="function"><a href="mysqli.real-escape-string.php" class="function">mysqli_real_escape_string()</a></span>. C&#039;est délibéré : taint
   sur-rapporte plutôt que d&#039;essayer de décider si une valeur est
   <q class="quote">sûre</q> pour un contexte de sortie particulier. Utiliser
   <span class="function"><a href="function.untaint.php" class="function">untaint()</a></span> pour effacer la marque sur des valeurs que
   l&#039;on a validées soi-même.
  </p>
 </div><?php manual_footer($setup); ?>