If I try to use a simple Phar call in my controller:
$tar = new \PharData('/path/to/myTar.tar');
I get the error:
"Unexpected file extension"
This is because Drupal Security checks to see if the file extension contains "phar", and rejects it if not. Unfortunately, the Phar library needs the extension to be ".tar" otherwise it won't work.
As a test, I disabled the security check, but it still didn't work:
TYPO3\PharStreamWrapper\Exception: Expected invocation could not be resolved
I've tested this on the same server outside of the Drupal environment and it worked fine. Has anybody had any success using Phar in Drupal 8?
DrupalKernel::boot()
, unconditionally, if there's aphar
stream wrapper available. It's not possible to re-initialise the phar manager (seeTYPO3\PharStreamWrapper\Manager::initialise()
), so without patching either the Kernel or Drupal's interceptor, I don't think there's an option – Clive♦ Sep 19 at 18:37