Task #85658

PharStreamWrapper denies phar files from symlinked extension

Added by Nicole Cordes almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2018-07-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Given:

An installation with symlinked extension(s)

Expected:

Able to execute an extensions phar file

Actual:

An exception is thrown because the phar path does not contain typo3conf.

I tested this with caretaker_mattermost as a symlinked extension in my local development environment.

The extension looks like

Warning: Uncaught TYPO3\CMS\Core\IO\PharStreamWrapperException:
Executing phar://...path-to-phar.../file.phar is denied in typo3/sysext/core/Classes/IO/PharStreamWrapper.php:507
#1

Updated by Oliver Hader almost 3 years ago

  • Status changed from New to Needs Feedback

How does the exception look like on your local environment? What is the real extension path & how does the symlink look like?

#2

Updated by Oliver Hader almost 3 years ago

Extension caretaker_mattermost uses __DIR__ when invoking the Phar bundle, which will then always be the resolved target of the symbolic link, see https://github.com/IchHabRecht/caretaker_mattermost/blob/bbb68361f4769832ea023d0c2df53a1e69be31b3/Classes/Services/ExitPoints/class.Tx_CaretakerMattermost_NotificationMattermmostExitPoint.php#L35

...
include_once 'phar://' . __DIR__ . '/../../../Resources/Php/thibaud-dauce-mattermost-php.phar/vendor/autoload.php';
...

Using \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('caretaker_mattermost') instead of __DIR__ should work then, thus having

...
include_once 'phar://' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('caretaker_mattermost')
    . '../../../Resources/Php/thibaud-dauce-mattermost-php.phar/vendor/autoload.php';
...
#3

Updated by Oliver Hader almost 3 years ago

  • Description updated (diff)
#4

Updated by Oliver Hader almost 3 years ago

  • Description updated (diff)
#5

Updated by Oliver Hader almost 3 years ago

  • Status changed from Needs Feedback to Accepted
  • Assignee set to Oliver Hader

Next step:
Create "important" ReST file that documents the behavior of the new PharStreamWrapper, its intention as well as the limitation and implication as mentioned in this ticket.

#6

Updated by Oliver Hader almost 3 years ago

  • Tracker changed from Bug to Task
#7

Updated by Oliver Hader almost 3 years ago

  • Assignee deleted (Oliver Hader)
#8

Updated by Gerrit Code Review almost 3 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57701

#9

Updated by Gerrit Code Review almost 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57701

#10

Updated by Gerrit Code Review almost 3 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57701

#11

Updated by Gerrit Code Review almost 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57701

#12

Updated by Gerrit Code Review almost 3 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57710

#13

Updated by Gerrit Code Review almost 3 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57711

#14

Updated by Oliver Hader almost 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#15

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF