ZF-11231: \Zend\Loader::isReadable() does not recognize absolute paths in phar archives

Description

{{\Zend\Loader::isReadable()}} only recognizes files in phar archives if the archive is added to the {{include_path}} and the filepath is relative (like tested in {{\ZendText\Loader\LoaderTest::testIsReadableShouldHonorStreamDefinitions()}}).

This becomes a problem when delivering modules as phars because in {{Zend\Controller\Dispatcher\Standard::isDispatchable()}} the full path of the controller class is passed to {{isReadable()}}.

This is a test case that illustrates the issue:

 
public function testIsReadableShouldFindAbsolutePathsInPhars()
    {
        $pharFile = __DIR__ . '/_files/Zend_LoaderTest.phar';
        $phar     = new Phar($pharFile, 0, 'zlt.phar');
        $incPath = 'phar://zlt.phar'
                 . PATH_SEPARATOR . $this->includePath;
        set_include_path($incPath);

    $pathToUserFile = 'phar://zlt.phar/User.php';
    $this->assertTrue(file_exists($pathToUserFile));
        $this->assertTrue(Loader::isReadable($pathToUserFile));
        unset($phar);
    }

BTW: using file_exists solves the problem

Comments

No comments to display