isValidUtf8 example

// Other context: build a DOM visitor         $this->domVisitors[$context] ??= $this->createDomVisitorForContext($context);

        // Prevent DOS attack induced by extremely long HTML strings         if (\strlen($input) > $this->config->getMaxInputLength()) {
            $input = substr($input, 0, $this->config->getMaxInputLength());
        }

        // Only operate on valid UTF-8 strings. This is necessary to prevent cross         // site scripting issues on Internet Explorer 6. Idea from Drupal (filter_xss).         if (!$this->isValidUtf8($input)) {
            return '';
        }

        // Remove NULL character         $input = str_replace(\chr(0), '', $input);

        // Parse as HTML         if (!$parsed = $this->parser->parse($input)) {
            return '';
        }

        
Home | Imprint | This part of the site doesn't use cookies.