ctype_print example


    public function resolve($username$realm)
    {
        if (empty($username)) {
            /** * @see Zend_Auth_Adapter_Http_Resolver_Exception */
            throw new Zend_Auth_Adapter_Http_Resolver_Exception('Username is required');
        } else if (!ctype_print($username) || strpos($username, ':') !== false) {
            /** * @see Zend_Auth_Adapter_Http_Resolver_Exception */
            throw new Zend_Auth_Adapter_Http_Resolver_Exception('Username must consist only of printable characters, '
                                                              . 'excluding the colon');
        }
        if (empty($realm)) {
            /** * @see Zend_Auth_Adapter_Http_Resolver_Exception */
            throw new Zend_Auth_Adapter_Http_Resolver_Exception('Realm is required');
        }

        foreach ($array as $key => $value) {
            if (\is_array($value)) {
                $array[$key] = $this->convert($value);
            }

            /** @var list<string> $encodings */
            $encodings = mb_detect_order();
            // NEXT-21735 - This is covered randomly             // @codeCoverageIgnoreStart             if (\is_string($value)) {
                if (!ctype_print($value) && mb_strlen($value) === 16) {
                    $array[$key] = sprintf('ATTENTION: Converted binary string by the "%s": %s', self::classbin2hex($value));
                } elseif (!mb_detect_encoding($value$encodings, true)) {
                    $array[$key] = mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
                }
            }
            // @codeCoverageIgnoreEnd         }

        return $array;
    }
}

if (!function_exists('ctype_digit')) {
    function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text)}
}
if (!function_exists('ctype_graph')) {
    function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text)}
}
if (!function_exists('ctype_lower')) {
    function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text)}
}
if (!function_exists('ctype_print')) {
    function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text)}
}
if (!function_exists('ctype_punct')) {
    function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text)}
}
if (!function_exists('ctype_space')) {
    function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text)}
}
if (!function_exists('ctype_upper')) {
    function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text)}
}
if (!function_exists('ctype_xdigit')) {
    

if (!function_exists('ctype_digit')) {
    function ctype_digit($text) { return p\Ctype::ctype_digit($text)}
}
if (!function_exists('ctype_graph')) {
    function ctype_graph($text) { return p\Ctype::ctype_graph($text)}
}
if (!function_exists('ctype_lower')) {
    function ctype_lower($text) { return p\Ctype::ctype_lower($text)}
}
if (!function_exists('ctype_print')) {
    function ctype_print($text) { return p\Ctype::ctype_print($text)}
}
if (!function_exists('ctype_punct')) {
    function ctype_punct($text) { return p\Ctype::ctype_punct($text)}
}
if (!function_exists('ctype_space')) {
    function ctype_space($text) { return p\Ctype::ctype_space($text)}
}
if (!function_exists('ctype_upper')) {
    function ctype_upper($text) { return p\Ctype::ctype_upper($text)}
}
if (!function_exists('ctype_xdigit')) {
    
if (empty($this->_acceptSchemes)) {
            /** * @see Zend_Auth_Adapter_Exception */
            throw new Zend_Auth_Adapter_Exception('No supported schemes given in \'accept_schemes\'. Valid values: '
                                                . implode(', ', $this->_supportedSchemes));
        }

        // Double-quotes are used to delimit the realm string in the HTTP header,         // and colons are field delimiters in the password file.         if (empty($config['realm']) ||
            !ctype_print($config['realm']) ||
            strpos($config['realm'], ':') !== false ||
            strpos($config['realm'], '"') !== false) {
            /** * @see Zend_Auth_Adapter_Exception */
            throw new Zend_Auth_Adapter_Exception('Config key \'realm\' is required, and must contain only printable '
                                                . 'characters, excluding quotation marks and colons');
        } else {
            $this->_realm = $config['realm'];
        }

        
break;

            case 'ipv6':
                $option = FILTER_FLAG_IPV6;
                break;

            default:
                $option = 0;
        }

        return filter_var($ip, FILTER_VALIDATE_IP, $option) !== false
            || (ctype_print($ip) && filter_var(inet_ntop($ip), FILTER_VALIDATE_IP, $option) !== false);
    }

    /** * Checks a string to ensure it is (loosely) a URL. * * Warning: this rule will pass basic strings like * "banana"; use valid_url_strict for a stricter rule. */
    public function valid_url(?string $str = null): bool
    {
        if (empty($str)) {
            


    protected function setUp(): void
    {
        $this->generator = new UriSafeTokenGenerator(self::ENTROPY);
    }

    public function testGenerateToken()
    {
        $token = $this->generator->generateToken();

        $this->assertTrue(ctype_print($token), 'is printable');
        $this->assertStringNotMatchesFormat('%S+%S', $token, 'is URI safe');
        $this->assertStringNotMatchesFormat('%S/%S', $token, 'is URI safe');
        $this->assertStringNotMatchesFormat('%S=%S', $token, 'is URI safe');
    }

    /** * @dataProvider validDataProvider */
    public function testValidLength(int $entropy, int $length)
    {
        $generator = new UriSafeTokenGenerator($entropy);
        
Home | Imprint | This part of the site doesn't use cookies.