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

[Bug|Magento]: After activating pro: Unable to find the wrapper "phar" #382

Closed
kayintveen opened this issue Feb 8, 2024 · 18 comments
Closed

Comments

@kayintveen
Copy link

Operating system version

macOS Sonoma 14.2.1 (23C71)

System architecture

ARM64 (M1, M2, etc)

Herd Version

1.4.0

PHP Version

PHP 8.1.26 (cli) (built: Dec 21 2023 08:51:01) (NTS)

Bug description

When I activated Pro, my CLI stopped working.

Warning: stream_resolve_include_path(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in phar:///Applications/Herd.app/Contents/Resources/valet/dump.phar/vendor/composer/ClassLoader.php on line 557

Tried restarting, rebooting, herd restart and switching between PHP 8.1 (which I need for this project) and 8.2

Steps to reproduce

actived pro on a clean install

Relevant log output

No response

@kayintveen kayintveen changed the title [Bug]: [Bug]: After activating pro: Unable to find the wrapper "phar" Feb 8, 2024
@mpociot
Copy link
Member

mpociot commented Feb 8, 2024

Are you sure that php on the CLI points to the correct binary?
Can you share your which php output?

@kayintveen
Copy link
Author

Yes

❯ which php
/Users/kayintveen/Library/Application Support/Herd/bin//php

@mpociot
Copy link
Member

mpociot commented Feb 8, 2024

What do you get when you run

php -i | grep "Registered PHP Streams"

It should give you: "Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip"

@sschlein
Copy link
Member

sschlein commented Feb 8, 2024

You should be back to a running system if you open the Dumps window and stop dump interception.

We're investigating this at the moment but it could be Magento related.

@kayintveen
Copy link
Author

What do you get when you run

php -i | grep "Registered PHP Streams"

It should give you: "Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip"

Phar is in there.
Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip

You should be back to a running system if you open the Dumps window and stop dump interception.

We're investigating this at the moment but it could be Magento related.

i was not sure how to do this. I expected this to be in the dumps pane to enable / disable it. but its in the dumps screen itself I can stop listening. and this fixed it for now.

@mpociot
Copy link
Member

mpociot commented Feb 8, 2024

This seems to be related to Magento unregistering the phar stream...

See: magento/magento2#21973

I suppose you run into this when running Magento related commands via the CLI?

@kayintveen
Copy link
Author

This seems to be related to Magento unregistering the phar stream...

See: magento/magento2#21973

I suppose you run into this when running Magento related commands via the CLI?

In this case I was indeed running bin/magento setup:upgrade

but before herd pro i had no issues (either with brew version of PHP or non-pro 1.4.0 herd.)

@mpociot
Copy link
Member

mpociot commented Feb 8, 2024

Yeah, Herd Pro loads a phar file to inject the dump and dd methods, which is why you ran into it - and which is why disabling the dump interception fixes it.

@kayintveen
Copy link
Author

For now i keep it disabled for magento hopefully a minor version upgrade will fix it later. Thanks!

@sschlein sschlein changed the title [Bug]: After activating pro: Unable to find the wrapper "phar" [Bug|Magento]: After activating pro: Unable to find the wrapper "phar" Feb 9, 2024
@mpociot
Copy link
Member

mpociot commented Mar 25, 2024

@kayintveen some time ago I sent you a potential fix for this. Did you find the time to try this?

@kayintveen
Copy link
Author

To be honest. its working now but i did not change the thing you did. not sure what did fix it though ;(

@barryvdh
Copy link

Same issue with the latest version. How can I disable the dump interception?

@barryvdh
Copy link

Nevermind, find the button. But still breaks Magento

@mpociot
Copy link
Member

mpociot commented May 31, 2024

@barryvdh I wasn't able to verify the fix that I sent to @kayintveen
Could you try the following:

Add

if (!in_array('phar', \stream_get_wrappers())) {
    \stream_wrapper_restore('phar');
}

To this file: /Applications/Herd.app/Contents/Resources/valet/dump-loader.php

Right before the include.
It seems like Magento is still unregistering the phar stream

@barryvdh
Copy link

Not sure how to best test that, my Mac doesn't seem to like me changing that file.

@kayintveen
Copy link
Author

Some how I fixed it. But I don't remember how. would love to have this working out of the box. i mainly had the issue with Magento as well.
Let me check with my team as more people use Magento with Herd now.

@barryvdh
Copy link

barryvdh commented Jun 3, 2024

If you disable the interception, there is no issue:
image

Does intercepting work for you now?

I think the fix should work, it's also mentioned here; magento/magento2#21973 (comment)

@mpociot
Copy link
Member

mpociot commented Jun 3, 2024

Yeah, when the interception is disabled we're not loading a PHAR file.

I'll just apply the fix in the next update, as I also doesn't see any reasons why this should break anything

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

4 participants