Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find the wrapper "phar" #435

Closed
srenon opened this issue Jun 21, 2019 · 3 comments
Closed

Unable to find the wrapper "phar" #435

srenon opened this issue Jun 21, 2019 · 3 comments
Assignees

Comments

@srenon
Copy link

srenon commented Jun 21, 2019

Magento 2.2.8

$ php pestle.phar magento2:class-list

Warning: require(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in /MagePal/magento2ce/lib/internal/Magento/Framework/registration.php on line 14

Warning: require(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in /MagePal/magento2ce/lib/internal/Magento/Framework/registration.php on line 14

Warning: file_get_contents(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in phar:///MagePal/magento2ce/pestle.phar/modules/pulsestorm/pestle/importer/module.php on line 273

Warning: file_get_contents(phar:///MagePal/pestle.phar/modules/pulsestorm/magento2/cli/class_list/module.php): failed to open stream: No such file or directory in phar:///MagePal/magento2ce/pestle.phar/modules/pulsestorm/pestle/importer/module.php on line 273

Notice: Undefined index: file in phar:///MagePal/magento2ce/pestle.phar/modules/pulsestorm/pestle/importer/module.php on line 407

Warning: file_get_contents(): Filename cannot be empty in phar:///MagePal/magento2ce/pestle.phar/modules/pulsestorm/pestle/importer/module.php on line 273

See

@astorm astorm self-assigned this Jun 22, 2019
@astorm
Copy link
Owner

astorm commented Jun 22, 2019

Maybe Magento will fix this on their end? (lol)

That's super annoying. We can probably fix it on this side by calling stream_wrapper_restore('phar'); right after bootstrapping Magento into place -- although I'm not sure what versions of PHP that exists in on what will happen if you you call it multiple times in same. sigh Fix would go right after this require statement:

require getBaseMagentoDir() . '/app/bootstrap.php';

I probably won't have time to work on this for a week or so, so if someone else wants to grab it from me and fix it then PR away.

@srenon out of curiosity, what do you use this command for? Most of the non generate pestle commands are one off scripts I wrote quick to do some small task then forgot about. I'd be curious to know what value you found from the class-list command.

srenon added a commit to srenon/pestle that referenced this issue Jun 22, 2019
Using the same fix as n98-magerun2 which work perfectly on 2.2.8. I did not test on other versions of Magento

netz98/n98-magerun2@59e0aec#diff-e42fe36d3628b1f8e91a653d64c7ba6d
@srenon
Copy link
Author

srenon commented Jun 22, 2019

Thanks for the quick reply!

I was just testing out Pestle and that was the first command I tried because I was curious to see what it does. But funny enough I had the same exact issue with an older version of n98-magerun2 with preventing all the functions from working. So I assumed the same was true here, but after trying other function they all worked.

@astorm
Copy link
Owner

astorm commented Jun 22, 2019

So I assumed the same was true here, but after trying other function they all worked.

Yes. This one command loads up Magento's app/bootstrap.php file so it can use the functionality provided by the Magento\Setup\Module\Di\Code\Reader\ClassesScanner class to find find all the "extendable" classes. To be honest I can't remember what, exactly, "extendable" means here :)

While it's possible to use Magneto classes without bootstrapping, you end up needing to manually instantiate everything in any constructor (thanks to Magento's automatic constructor dependency injection), which can be pretty tedious and error prone.

Other pestle commands don't need to load/bootstrap a Magento environment, so they're fine.

I yoinked a fix from @cmuench and merged it.

I'm honestly not sure when this fix will land in a release -- historically we tend to flll up a "current sprint" milestone with 10 complete issues and then do a release, but development's been slow around here and the docs sprint is our priority at the moment. And when I say "we" and "our" I mean me :)

If anyone's burning to checkout this command with a Magento 2.3.1 system the README has instructions for using phing to do your own build.

@srenon Thanks again for reporting this, and apologies that your first experience with pestle was an error. We I hope it doesn't sour you on the command. We're closing this issue out now, but if you need anything else please feel free to comment/re-open.

@astorm astorm closed this as completed Jun 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants