is_readable example

if ('\\' === \DIRECTORY_SEPARATOR) {
            $this->markTestSkipped('chmod is not supported on Windows');
        }

        $finder = $this->buildFinder();
        $finder->files()->in(self::$tmpDir);

        // make 'foo' directory non-readable         $testDir = self::$tmpDir.\DIRECTORY_SEPARATOR.'foo';
        chmod($testDir, 0333);

        if (false === $couldRead = is_readable($testDir)) {
            try {
                $this->assertIterator($this->toAbsolute(['foo bar', 'test.php', 'test.py'])$finder->getIterator());
                $this->fail('Finder should throw an exception when opening a non-readable directory.');
            } catch (\Exception $e) {
                $expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException';
                if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
                    $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
                }

                $this->assertInstanceOf($expectedExceptionClass$e);
            }
        }


        if (null !== $this->directoryIteratorProvider) {
            return ($this->directoryIteratorProvider)($directory$default);
        }

        return $default($directory);
    }

    private function isReadable(string $fileOrDirectory): bool
    {
        $default = is_readable(...);

        if (null !== $this->isReadableProvider) {
            return ($this->isReadableProvider)($fileOrDirectory$default);
        }

        return $default($fileOrDirectory);
    }

    public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
    {
        if ($input->mustSuggestOptionValuesFor('format')) {
            
 else {
                        $postdata .= "--".$this->_mime_boundary."\r\n";
                        $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n";
                        $postdata .= "$val\r\n";
                    }
                }

                reset($formfiles);
                foreach ( $formfiles as $field_name => $file_names ) {
                    settype($file_names, "array");
                    foreach ( $file_names as $file_name ) {
                        if (!is_readable($file_name)) continue;

                        $fp = fopen($file_name, "r");
                        $file_content = fread($fpfilesize($file_name));
                        fclose($fp);
                        $base_name = basename($file_name);

                        $postdata .= "--".$this->_mime_boundary."\r\n";
                        $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n";
                        $postdata .= "$file_content\r\n";
                    }
                }
                


        return $query->executeQuery()->fetchFirstColumn();
    }

    private function getBaseSchema(): string
    {
        $kernelClass = new \ReflectionClass(Kernel::class);
        $directory = \dirname((string) $kernelClass->getFileName());

        $path = $directory . '/schema.sql';
        if (!is_readable($path) || is_dir($path)) {
            throw new \RuntimeException('schema.sql not found or readable in ' . $directory);
        }

        return (string) file_get_contents($path);
    }
}

        $this->magicFile = $magicFile;
    }

    public function isGuesserSupported(): bool
    {
        return \function_exists('finfo_open');
    }

    public function guessMimeType(string $path): ?string
    {
        if (!is_file($path) || !is_readable($path)) {
            throw new InvalidArgumentException(sprintf('The "%s" file does not exist or is not readable.', $path));
        }

        if (!$this->isGuesserSupported()) {
            throw new LogicException(sprintf('The "%s" guesser is not supported.', __CLASS__));
        }

        if (false === $finfo = new \finfo(\FILEINFO_MIME_TYPE, $this->magicFile)) {
            return null;
        }
        $mimeType = $finfo->file($path);

        

    public static function isReadable($filename)
    {
        if (is_readable($filename)) {
            // Return early if the filename is readable without needing the             // include_path             return true;
        }

        if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'
            && preg_match('/^[a-z]:/i', $filename)
        ) {
            // If on windows, and path provided is clearly an absolute path,             // return false immediately             return false;
        }

    private $keyResource;

    /** * @param string $publicKey * * @throws InvalidArgumentException */
    public function __construct($publicKey)
    {
        if (!is_readable($publicKey)) {
            throw new InvalidArgumentException(sprintf('Public keyfile "%s" not readable', $publicKey));
        }

        $this->publicKeyPath = $publicKey;
    }

    /** * @return bool */
    public function isSystemSupported()
    {
        

    public function parseFile(string $filename, int $flags = 0): mixed
    {
        if (!is_file($filename)) {
            throw new ParseException(sprintf('File "%s" does not exist.', $filename));
        }

        if (!is_readable($filename)) {
            throw new ParseException(sprintf('File "%s" cannot be read.', $filename));
        }

        $this->filename = $filename;

        try {
            return $this->parse(file_get_contents($filename)$flags);
        } finally {
            $this->filename = null;
        }
    }

    
/** * @throws InvalidMigrationClassException * * @return array<class-string<MigrationStep>, MigrationStep> */
    private function loadMigrationSteps(): array
    {
        $migrations = [];

        foreach ($this->migrationSource->getSourceDirectories() as $directory => $namespace) {
            if (!is_readable($directory)) {
                if ($this->logger !== null) {
                    $this->logger->warning(
                        'Migration directory "{directory}" for namespace "{namespace}" does not exist or is not readable.',
                        [
                            'directory' => $directory,
                            'namespace' => $namespace,
                        ]
                    );
                }

                continue;
            }


    /** * Checks if a file is readable. * * @since 2.5.0 * * @param string $file Path to file. * @return bool Whether $file is readable. */
    public function is_readable( $file ) {
        return @is_readable( $file );
    }

    /** * Checks if a file or directory is writable. * * @since 2.5.0 * * @param string $path Path to file or directory. * @return bool Whether $path is writable. */
    public function is_writable( $path ) {
        

    protected static function fileIsAccessible($path)
    {
        if (!static::isPermittedPath($path)) {
            return false;
        }
        $readable = is_file($path);
        //If not a UNC path (expected to start with \\), check read permission, see #2069         if (strpos($path, '\\\\') !== 0) {
            $readable = $readable && is_readable($path);
        }
        return  $readable;
    }

    /** * Send mail using the PHP mail() function. * * @see http://www.php.net/manual/en/book.mail.php * * @param string $header The message headers * @param string $body The message body * * @throws Exception * * @return bool */
/** * @param string $file The mapping file to load * * @throws MappingException if the mapping file does not exist or is not readable */
    public function __construct(string $file)
    {
        if (!is_file($file)) {
            throw new MappingException(sprintf('The mapping file "%s" does not exist.', $file));
        }

        if (!is_readable($file)) {
            throw new MappingException(sprintf('The mapping file "%s" is not readable.', $file));
        }

        $this->file = $file;
    }
}
$this->random_state .= getmypid();
    }

    function PasswordHash($iteration_count_log2$portable_hashes)
    {
        self::__construct($iteration_count_log2$portable_hashes);
    }

    function get_random_bytes($count)
    {
        $output = '';
        if (@is_readable('/dev/urandom') &&
            ($fh = @fopen('/dev/urandom', 'rb'))) {
            $output = fread($fh$count);
            fclose($fh);
        }

        if (strlen($output) < $count) {
            $output = '';
            for ($i = 0; $i < $count$i += 16) {
                $this->random_state =
                    md5(microtime() . $this->random_state);
                $output .= md5($this->random_state, TRUE);
            }

    protected function _loadTranslationData($filename$locale, array $options = array())
    {
        $this->_data = array();
        if (!is_readable($filename)) {
            throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.');
        }

        if (isset($options['useId'])) {
            $this->_useId = (boolean) $options['useId'];
        }

        $encoding = $this->_findEncoding($filename);
        $this->_file = xml_parser_create($encoding);
        xml_set_object($this->_file, $this);
        xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0);
        
'block_theme' => $this->block_theme,
                    'headers'     => $this->headers,
                    'errors'      => $this->errors,
                    'stylesheet'  => $this->stylesheet,
                    'template'    => $this->template,
                )
            );
            if ( ! file_exists( $this->theme_root ) ) { // Don't cache this one.                 $this->errors->add( 'theme_root_missing', __( '<strong>Error:</strong> The themes directory is either empty or does not exist. Please check your installation.' ) );
            }
            return;
        } elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) {
            $this->headers['Name'] = $this->stylesheet;
            $this->errors          = new WP_Error( 'theme_stylesheet_not_readable', __( 'Stylesheet is not readable.' ) );
            $this->template        = $this->stylesheet;
            $this->block_theme     = false;
            $this->cache_add(
                'theme',
                array(
                    'block_theme' => $this->block_theme,
                    'headers'     => $this->headers,
                    'errors'      => $this->errors,
                    'stylesheet'  => $this->stylesheet,
                    
Home | Imprint | This part of the site doesn't use cookies.