-
Notifications
You must be signed in to change notification settings - Fork 268
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
PHP content type headers ignored? #1223
Comments
Good catch @dennisnissle! I just added that to the project board as a high priority issue. |
PDF was missing in the infer mime type list #1298 which prevented static PDF files from being opened with the PDF content-type. I added it but PDFs still don't load inside the Playground iframe. I think this is related to how iframes work, but need to research it more. This blueprint will open a PDF in Firefox, but in Chrome it will fail with status blocked:other. If you open the path in a new tag, the PDF will load. So, I think that PHP-WASM works correctly here, but there is an issue in Playground caused by it running in an iframe. I was able to get inline PDFs to work in Playground without adding the mime type.
|
@dennisnissle could you please share more details on how to recreate your issue? In my testing |
@bgrgicak you are right - the issue was related to the (PHP) library I was using to inline/output the PDF. The library checks for the PS: I was able to allow inline outputting the PDF (even in chrome) by removing the sandbox attributes of the iframe: https://github.com/WordPress/wordpress-playground/blob/trunk/packages/playground/remote/remote.html#L59 |
Thank you! This just saved me a lot of research 🙂 |
Adds a PHP Process manager, a class that can spawn maintain a number of PHP instances at the same time. The idea is to have: * A single "primary" PHP instance that's never killed – it contains the reference filesystem used by all other PHP instances. * A pool of disposable PHP instances that are spawned to handle a single request and reaped immediately after. Spawning new PHP instances is reasonably fast and can happen on demand, there's no need to keep a pool of "warm" instances that occupies the memory all the time. Example usage: ```ts const mgr = new PHPProcessManager({ phpFactory: async () => NodePHP.load(RecommendedPHPVersion), maxPhpInstances: 4, }); const instance = await mgr.getInstance(); await instance.php.run({ code }); instance.reap(); ``` Related to #1287 ## Remaining work * Add a "context" parameter to `getInstance()` to enable setting the correct SAPI Name, e.g. `CLI` or `FPM` depending on the purpose the PHP instance is created for. This would solve issues like #1223. Alternatively, the consuming program could call `setSapiName()` on the PHP instance returned by `getInstance()` – but that assumes the factory did not initialize the web runtime. ## Testing instructions Confirm the unit tests pass. This PR only adds new code, it does not plug in the PHPProcessManager class into any request dispatching code yet.
Hi there,
I was just testing some functionality of my plugin which sends a PDF as inline to the browser:
within the playground the headers seem to be ignored:
I know that it used to work with playground once - but the current version doesn't seem to support it.
Best,
Dennis
The text was updated successfully, but these errors were encountered: