Issue

ZF-11115: Zend Translate / realpath() is not tolerant of phar paths

Issue Type: Bug Created: 2011-02-25T09:26:01.000+0000 Last Updated: 2011-08-26T18:26:41.000+0000 Status: Resolved Fix version(s): - Next Major Release ()

Reporter: Jesse Patching (taeram) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

Related issues: Attachments:

Description

Zend Translate is not tolerant of phar paths because the use of the PHP realpath() function, which causes phar paths to be returned as 'false'.

Zend_Translate_Adapter::addTranslation() example:

<pre class="highlight">
    $options['content'] = realpath($options['content']);

A path of 'phar://foo.phar' will result in a returned value of 'false'

Proposed patch:

<pre class="highlight">
if (strpos($options['content'], '://') === false) {
    $options['content'] = realpath($options['content']);
}

This is a currently known PHP bug, but has not yet been fixed: http://bugs.php.net/bug.php?id=52769

Comments

Posted by Thomas Weidner (thomas) on 2011-02-25T11:50:42.000+0000

Not accepted This would disallow the usage of network and uripaths as translation source

Posted by Matthew Weier O'Phinney (matthew) on 2011-02-25T12:33:28.000+0000

Thomas: I understand you didn't accept the proposed solution, but this is still an important use case. If the proposed solution does not work, then work with the reporter to find a solution that supports phar as well as network and URI paths.

Posted by Jesse Patching (taeram) on 2011-02-25T13:12:44.000+0000

Since this is a phar specific issue, we can just exclude phar streams from using realpath().

Proposed patch updated:

<pre class="highlight">
if (strpos($options['content'], 'phar://') === false) {
    $options['content'] = realpath($options['content']);
}

Posted by Thomas Weidner (thomas) on 2011-08-26T18:26:41.000+0000

Fixed in ZF2 with GH-297

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts