View in #core on Slack
Tim Kaye: Just tried updating from RC1 to RC2 and got this error: " The package could not be installed.: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature"
@jnylen: @Tim Kaye following up on this - you need to install the cURL extension for PHP, and that should fix this issue. If youāre using Debian, Ubuntu etc, you can install the php-curl
package and reload your webserver. Also reported here, with the same resolution: Update failed - PCLZIP error
@slack1596: @jnylen we should add some checks for extensions to the installer and migration plugin
@jnylen: the way this is supposed to work if curl isnāt present is https://github.com/ClassicPress/ClassicPress/blob/develop/src/wp-includes/Requests/Transport/fsockopen.php
sometimes it does, sometimes it doesnāt
when this issue occurs it is a really weird oneā¦ extra bytes are added into the downloaded file
always of the form \r\n[0-9a-f]{2,4}\r\n
@slack1596: ah - i know what that is
(i think)
thatāll be some sort of broken chunked reply
@jnylen:
yeah
Iāve never seen this particular failure before though
like something is including the chunk size with each chunk?
@slack1596: looks like it
@jnylen: wtf
@slack1596: the numbers look pretty close on that screenshot
@jnylen: yeah, they add up
and why would one site on this server update just fine, but another one not
and why would this (almost) always happen immediately before the PK
bytes of the zip file
anyway, I think the next thing to do is to see how common this actually is
and more generally, now that we already have an active install base, adding new restrictions on servers is going to be unpleasant
weād have to do it in stages - measure, inform, deprecate, then disable
@slack1596: i think itās just not understanding the chunked transfer properly
curl can be on the ārecommendedā list
@jnylen: https://stackoverflow.com/questions/4966476/php-from-fsockopen-result-how-to-remove-chunked-data-and-get-data
Stack Overflow: php, From fsockopen result, how to remove chunked data and get data
@slack1596: yup
@jnylen: yep, thatās it
chunked data + request saved to file is no good
@slack1596: cool - simple fix then
@jnylen: moderately
@slack1596: parsing chunked content is pretty simple
@jnylen: https://github.com/rmccue/Requests/issues/189
[rmccue/Requests] #189 Chunked encoding isnāt handled for file streaming
https://github.com/ClassicPress/ClassicPress/blob/b75ade79919ee2fb4bec9d1874af5a8b4f386af8/src/wp-includes/class-requests.php#L744-L786
[ClassicPress/ClassicPress] src/wp-includes/class-requests.php:744-786
https://github.com/ClassicPress/ClassicPress/blob/b75ade79919ee2fb4bec9d1874af5a8b4f386af8/src/wp-includes/Requests/Transport/fsockopen.php#L240-L246
[ClassicPress/ClassicPress] src/wp-includes/Requests/Transport/fsockopen.php:240-246
fitting those 2 blocks of code together seems annoying
@slack1596: donāt think iāve ever seen a regex with quite so many question marks in itā¦
@jnylen: I like regex, but not like that
ok, so this has been fun
all of the code to pick a HTTP transport (curl or fsockopen) is written twice (old and new, it looks like)
for example https://github.com/ClassicPress/ClassicPress/blob/develop/src/wp-includes/Requests/Transport/fsockopen.php and https://github.com/ClassicPress/ClassicPress/blob/develop/src/wp-includes/class-wp-http-streams.php
[ClassicPress/ClassicPress] src/wp-includes/Requests/Transport/fsockopen.php
[ClassicPress/ClassicPress] src/wp-includes/class-wp-http-streams.php
for core updates we can set the protocol version to HTTP/1.0 to fix this
but WP-CLI bundles its own version of the Requests library, so I think thereās nothing we can do about that ourselves
@slack1596: joy!
@jnylen: https://github.com/ClassicPress/ClassicPress/pull/397
Iām not sure if we actually want to do that, but it works