Ver código fonte

Add Unicode Normalization

Canonical Decomposition followed by Canonical Composition for all input data
Visman 4 anos atrás
pai
commit
9575efce44
2 arquivos alterados com 4 adições e 0 exclusões
  1. 3 0
      app/Core/Secury.php
  2. 1 0
      composer.json

+ 3 - 0
app/Core/Secury.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 
 namespace ForkBB\Core;
 namespace ForkBB\Core;
 
 
+use Normalizer;
 use RuntimeException;
 use RuntimeException;
 use UnexpectedValueException;
 use UnexpectedValueException;
 use InvalidArgumentException;
 use InvalidArgumentException;
@@ -89,6 +90,8 @@ class Secury
         //$data = mb_convert_encoding((string) $data, 'UTF-8', 'UTF-8');
         //$data = mb_convert_encoding((string) $data, 'UTF-8', 'UTF-8');
         // fast, large memory
         // fast, large memory
         $data = \htmlspecialchars_decode(\htmlspecialchars((string) $data, \ENT_SUBSTITUTE, 'UTF-8'));
         $data = \htmlspecialchars_decode(\htmlspecialchars((string) $data, \ENT_SUBSTITUTE, 'UTF-8'));
+        // Canonical Decomposition followed by Canonical Composition
+        $data = Normalizer::normalize($data, Normalizer::FORM_C);
         // Remove control characters
         // Remove control characters
         return \preg_replace('%[\x00-\x08\x0B-\x0C\x0E-\x1F]%', '', $data);
         return \preg_replace('%[\x00-\x08\x0B-\x0C\x0E-\x1F]%', '', $data);
     }
     }

+ 1 - 0
composer.json

@@ -28,6 +28,7 @@
         "ext-gd": "*",
         "ext-gd": "*",
         "ext-mbstring": "*",
         "ext-mbstring": "*",
         "ext-fileinfo": "*",
         "ext-fileinfo": "*",
+        "ext-intl" : "*",
         "artoodetoo/dirk": "dev-visman",
         "artoodetoo/dirk": "dev-visman",
         "miovisman/parserus": "dev-master",
         "miovisman/parserus": "dev-master",
         "miovisman/normemail": "dev-master",
         "miovisman/normemail": "dev-master",