joomlatools / joomlatools-composer

Composer extension installer for Joomla.
https://www.joomlatools.com/developer/tools/composer/
GNU General Public License v3.0
52 stars 13 forks source link

Reset the phar wrapper #44

Closed magneticmg closed 4 years ago

magneticmg commented 5 years ago

As of Joomla! 3.9.4 the phar stream wrapper is re-registered using the typo3/phar-stream-wrapper.

After that, using the joomlatools/composer would fail with an unexpected file extension error.

This PR:

  1. simply resets the phar stream wrapper to the previously set wrapper.

You may want to do a deeper dive into the underlying security concern, but this certainly fixed the immediate issue.

magneticmg commented 5 years ago

My previous solution in fact was not working on subsequent composer updates. It misinterpreted what was been stored in the array returned from stream_get_wrapper. The current solution is to use stream_wrapper_restore('phar'); just after the cms is bootstrapped and that seems to help.

johanjanssens commented 4 years ago

@magneticmg @stevenrombauts Encountered this problem too. Seems to be related to: https://github.com/TYPO3/phar-stream-wrapper/issues/21

Not tested yet, but changing the dependency to 'typo3/phar-stream-wrapper": "^3.1"' should solve it, Joomla is still pointing to 2.1.

Could indeed reset the wrapper on our end when using console, the typo3 one adds additional security, so no harm in that.

stevenrombauts commented 4 years ago

@magneticmg @johanjanssens Tested this on my end as well, resetting the wrapper sorts out the issue on Joomla 3.9+.

johanjanssens commented 4 years ago

Great! :)