# wp-optimize/3.4.2/vendor/rosell-dk/webp-convert/src/Helpers/Sanitize.php

WP-Optimize – Cache, Compress images, Minify &amp; Clean database to boost page speed &amp; performance, version 3.4.2. 31 lines.

- Page: https://pluginprobe.com/plugins/wp-optimize/3.4.2/code/vendor/rosell-dk/webp-convert/src/Helpers/Sanitize.php
- Raw: https://pluginprobe.com/plugins/wp-optimize/3.4.2/raw/vendor/rosell-dk/webp-convert/src/Helpers/Sanitize.php
- Modified: 2021-06-07T22:42:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-optimize/3.4.2/code/vendor/rosell-dk/webp-convert/src/Helpers/Sanitize.php#L10-L20`.

```php
<?php

namespace WebPConvert\Helpers;

class Sanitize
{

    /**
     *  The NUL character is a demon, because it can be used to bypass other tests
     *  See https://st-g.de/2011/04/doing-filename-checks-securely-in-PHP.
     *
     *  @param  string  $string  string remove NUL characters in
     */
    public static function removeNUL($string)
    {
        return str_replace(chr(0), '', $string);
    }

    public static function removeStreamWrappers($string)
    {
        return preg_replace('#^\\w+://#', '', $string);
    }

    public static function path($string)
    {
        $string = self::removeNUL($string);
        $string = self::removeStreamWrappers($string);
        return $string;
    }
}

```
