box icon indicating copy to clipboard operation
box copied to clipboard

File contents are missing in compressed zip

Open jaapio opened this issue 5 years ago • 5 comments

Bug report

Question Answer
Box version 3.8.4@120b0a3 2019-12-13 17:22:43 UTC
PHP version 7.3.6
Platform with version Debian (docker php)
Github Repo https://github.com/phpDocumentor/phpDocumentor

We were using the GZ compression but for some reason, we got a report that a number of warnings were triggered during the execution of phpdocumentor when phar.readonly=off after some debugging I found that some of the files included in the phar were empty.

After disabling the compression the warnings are gone. Linked issue: https://github.com/phpDocumentor/phpDocumentor/issues/2161

jaapio avatar Dec 15 '19 20:12 jaapio

I'm genuinely confused this does not make any sense. But good news is I've got some leads :)

So first of all, as you can see here, there is nothing fancy in the compression it's mostly the raw PHAR extension API. The main difference is in the way it is done to avoid hitting the file description limit (it is bumped just before in Compile.php).

You are however mentioning phar.readonly=off and I noticed phpDocumentor switched to Symfony. So it leads me to two things:

  • When you have phar.readonly=on, to compile your PHAR, Box will restart the process to set phar.readonly=off instead. The same is done if xdebug is enabled to disable it in order to speed things up. I however hardly see how this could be the cause so if it is it would require more extensive investigation.
  • The compiler is not compiled correctly

I have strong suspicions on the second one because if that is the case, then the container will try to dump the "compiled" version in the PHAR and that is not possible unless you have phar.readonly=off. But even so you will change the PHAR signature and it won't work for everyone, a PHAR must be seen as putting your application in a read-only environment.

I strongly suggest you to read this doc entry in details and giving it another go.

If that turns out to be unhelpful, I would like if possible:

  • details on the building process
  • the output with --debug, especially the configuration file dump (in .box_dump)

theofidry avatar Dec 15 '19 22:12 theofidry

Thanks for the feedback I'm going giving it a try to find out what is going on.

jaapio avatar Dec 16 '19 08:12 jaapio

Had a quick look: this looks more related to the Symfony cache not working well with the compression. So a bug yes but likely on Symfony side

theofidry avatar Jan 23 '20 14:01 theofidry

@jaapio did you manage to make it work?

theofidry avatar Jun 23 '22 23:06 theofidry

It's a long time ago, but I think this is still an issue. I never tried it since I created this issue.

But it's ok for me to close this issue for now. I will create a new issue when I have time to provide proper feedback.

jaapio avatar Jun 24 '22 12:06 jaapio