<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[57929] branches/6.4: Upload: Fallback to PclZip to validate ZIP file uploads.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/57929">57929</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/57929","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jorbin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-04-04 19:28:21 +0000 (Thu, 04 Apr 2024)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Upload: Fallback to PclZip to validate ZIP file uploads.

ZipArchive can fail to validate ZIP files correctly and report valid files as invalid. This introduces a fallback to PclZip to check validity of files if ZipArchive fails them.

This introduces the new function wp_zip_file_is_valid() to validate archives.

Follow up to <a href="https://core.trac.wordpress.org/changeset/57388">[57388]</a>.

Reviewed by jorbin.
Merges <a href="https://core.trac.wordpress.org/changeset/57537">[57537]</a> to the 6.4 branch.

Props audunmb, azaozz, britner, cdevroe, colorful-tones, costdev, courane01, endymion00, feastdesignco, halounsbury, jeffpaul, johnbillion, jorbin, jsandtro, karinclimber, kevincoleman, koesper, maartenbelmans, mathewemoore, melcarthus, mujuonly, nerdpressteam, olegfuture, otto42, peterwilsoncc, room34, sayful, schutzsmith, stephencronin, svitlana41319, swissspidy, tnolte, tobiasbg, vikram6, welaunchio.
Fixes <a href="https://core.trac.wordpress.org/ticket/60398">#60398</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches64srcwpadminincludesclassfileuploadupgraderphp">branches/6.4/src/wp-admin/includes/class-file-upload-upgrader.php</a></li>
<li><a href="#branches64srcwpadminincludesfilephp">branches/6.4/src/wp-admin/includes/file.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branches64testsphpunitdatafilesystem_sourcelicense">branches/6.4/tests/phpunit/data/filesystem/_source-license</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchivecommentzip">branches/6.4/tests/phpunit/data/filesystem/archive-comment.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchivecp866zip">branches/6.4/tests/phpunit/data/filesystem/archive-cp866.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchivedirectoryentryzip">branches/6.4/tests/phpunit/data/filesystem/archive-directory-entry.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchiveencryptedzip">branches/6.4/tests/phpunit/data/filesystem/archive-encrypted.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchiveflagssetzip">branches/6.4/tests/phpunit/data/filesystem/archive-flags-set.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchivegnomezip">branches/6.4/tests/phpunit/data/filesystem/archive-gnome.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchiveinvalidextmd">branches/6.4/tests/phpunit/data/filesystem/archive-invalid-ext.md</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchiveinvalidzip">branches/6.4/tests/phpunit/data/filesystem/archive-invalid.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchivelargezip">branches/6.4/tests/phpunit/data/filesystem/archive-large.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchivemacoszip">branches/6.4/tests/phpunit/data/filesystem/archive-macos.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchiveubuntunautiluszip">branches/6.4/tests/phpunit/data/filesystem/archive-ubuntu-nautilus.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchiveuncompressedzip">branches/6.4/tests/phpunit/data/filesystem/archive-uncompressed.zip</a></li>
<li><a href="#branches64testsphpunitdatafilesystemarchivecrx">branches/6.4/tests/phpunit/data/filesystem/archive.crx</a></li>
<li><a href="#branches64testsphpunittestsfilesystemwpZipFileIsValidphp">branches/6.4/tests/phpunit/tests/filesystem/wpZipFileIsValid.php</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#branches64">branches/6.4/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/6.4
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/6.4 2024-04-04 18:53:39 UTC (rev 57928)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/6.4  2024-04-04 19:28:21 UTC (rev 57929)
</ins><a id="branches64"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/6.4</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43747,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43785,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43863,43867-43889,43891-43894,43897-43905,43908-43909,43911-43929,43931-43942,43946-43947,43949-43956,43959-43964,43967-43969,43988,43994,44014,44017,44047,44183,44185,44187-44206,44208-44213,44231-44232,44235,44248,44284,44287-44288
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.5:49373-49379,49381
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.8:51889
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:56974,56978,56984,56987,56990-56992,56996,56999,57003,57009,57012-57013,57018-57019,57021-57022,57028-57029,57032-57034,57036,57044,57046,57048,57054,57063,57066-57067,57069,57075,57081,57084,57086,57089,57093,57102,57127,57129,57142,57147,57151,57163,57212,57275-57277,57296,57306,57357,57388-57389,57568,57667,57678
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:56974,56978,56984,56987,56990-56992,56996,56999,57003,57009,57012-57013,57018-57019,57021-57022,57028-57029,57032-57034,57036,57044,57046,57048,57054,57063,57066-57067,57069,57075,57081,57084,57086,57089,57093,57102,57127,57129,57142,57147,57151,57163,57212,57275-57277,57296,57306,57357,57388-57389,57537,57568,57667,57678
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches64srcwpadminincludesclassfileuploadupgraderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.4/src/wp-admin/includes/class-file-upload-upgrader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.4/src/wp-admin/includes/class-file-upload-upgrader.php 2024-04-04 18:53:39 UTC (rev 57928)
+++ branches/6.4/src/wp-admin/includes/class-file-upload-upgrader.php   2024-04-04 19:28:21 UTC (rev 57929)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -70,24 +70,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( 'pluginzip' === $form || 'themezip' === $form ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $archive_is_valid = false;
-
-                               /** This filter is documented in wp-admin/includes/file.php */
-                               if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
-                                       $archive          = new ZipArchive();
-                                       $archive_is_valid = $archive->open( $file['file'], ZIPARCHIVE::CHECKCONS );
-
-                                       if ( true === $archive_is_valid ) {
-                                               $archive->close();
-                                       }
-                               } else {
-                                       require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
-
-                                       $archive          = new PclZip( $file['file'] );
-                                       $archive_is_valid = is_array( $archive->properties() );
-                               }
-
-                               if ( true !== $archive_is_valid ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( ! wp_zip_file_is_valid( $file['file'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         wp_delete_file( $file['file'] );
</span><span class="cx" style="display: block; padding: 0 10px">                                        wp_die( __( 'Incompatible Archive.' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span></span></pre></div>
<a id="branches64srcwpadminincludesfilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.4/src/wp-admin/includes/file.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.4/src/wp-admin/includes/file.php       2024-04-04 18:53:39 UTC (rev 57928)
+++ branches/6.4/src/wp-admin/includes/file.php 2024-04-04 19:28:21 UTC (rev 57929)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1564,6 +1564,37 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Determines whether the given file is a valid ZIP file.
+ *
+ * This function does not test to ensure that a file exists. Non-existent files
+ * are not valid ZIPs, so those will also return false.
+ *
+ * @since 6.4.4
+ *
+ * @param string $file Full path to the ZIP file.
+ * @return bool Whether the file is a valid ZIP file.
+ */
+function wp_zip_file_is_valid( $file ) {
+       /** This filter is documented in wp-admin/includes/file.php */
+       if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
+               $archive          = new ZipArchive();
+               $archive_is_valid = $archive->open( $file, ZipArchive::CHECKCONS );
+               if ( true === $archive_is_valid ) {
+                       $archive->close();
+                       return true;
+               }
+       }
+
+       // Fall through to PclZip if ZipArchive is not available, or encountered an error opening the file.
+       require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
+
+       $archive          = new PclZip( $file );
+       $archive_is_valid = is_array( $archive->properties() );
+
+       return $archive_is_valid;
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Unzips a specified ZIP file to a location on the filesystem via the WordPress
</span><span class="cx" style="display: block; padding: 0 10px">  * Filesystem Abstraction.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystem_sourcelicensefromrev57537trunktestsphpunitdatafilesystem_sourcelicense"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/_source-license (from rev 57537, trunk/tests/phpunit/data/filesystem/_source-license)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.4/tests/phpunit/data/filesystem/_source-license                                (rev 0)
+++ branches/6.4/tests/phpunit/data/filesystem/_source-license  2024-04-04 19:28:21 UTC (rev 57929)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,33 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+The following files were sourced from https://github.com/ZJONSSON/node-unzipper a fork of https://github.com/EvanOxfeld/node-unzip
+
+* archive-comment.zip
+* archive-cp866.zip
+* archive-directory-entry.zip
+* archive-encrypted.zip
+* archive-flags-set.zip
+* archive-invalid.zip
+* archive-large.zip
+* archive-uncompressed.zip
+* archive.crx
+
+Copyright (c) 2012 - 2013 Near Infinity Corporation
+Copyright (c) 2016 - 2024 Ziggy Jonsson (ziggy.jonsson.nyc@gmail.com)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</ins></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchivecommentzipfromrev57537trunktestsphpunitdatafilesystemarchivecommentzip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-comment.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-comment.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchivecp866zipfromrev57537trunktestsphpunitdatafilesystemarchivecp866zip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-cp866.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-cp866.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchivedirectoryentryzipfromrev57537trunktestsphpunitdatafilesystemarchivedirectoryentryzip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-directory-entry.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-directory-entry.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchiveencryptedzipfromrev57537trunktestsphpunitdatafilesystemarchiveencryptedzip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-encrypted.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-encrypted.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchiveflagssetzipfromrev57537trunktestsphpunitdatafilesystemarchiveflagssetzip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-flags-set.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-flags-set.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchivegnomezipfromrev57537trunktestsphpunitdatafilesystemarchivegnomezip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-gnome.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-gnome.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchiveinvalidextmdfromrev57537trunktestsphpunitdatafilesystemarchiveinvalidextmd"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-invalid-ext.md (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-invalid-ext.md)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.4/tests/phpunit/data/filesystem/archive-invalid-ext.md                         (rev 0)
+++ branches/6.4/tests/phpunit/data/filesystem/archive-invalid-ext.md   2024-04-04 19:28:21 UTC (rev 57929)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,7 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Shucked
+
+Shucked is a 2022 musical with music and lyrics by Brandy Clark and Shane McAnally, and a book by Robert Horn. The Broadway production began previews at the Nederlander Theatre on March 8, 2023, before opening on April 4. The show received positive reviews and went on to receive nine nominations at the 76th Tony Awards, including Best Musical. Cast member Alex Newell became one of the first two openly non-binary performers to be nominated for and win a Tony Award, with their win for Best Featured Actor in a Musical.
+
+A U.S. tour, West End production, and feature film adaptation are currently planned.
+
+From Wikipedia (https://en.wikipedia.org/wiki/Shucked) under Creative Commons Attribution CC-BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/legalcode)
</ins></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchiveinvalidzipfromrev57537trunktestsphpunitdatafilesystemarchiveinvalidzip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-invalid.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-invalid.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchivelargezipfromrev57537trunktestsphpunitdatafilesystemarchivelargezip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-large.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-large.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchivemacoszipfromrev57537trunktestsphpunitdatafilesystemarchivemacoszip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-macos.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-macos.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchiveubuntunautiluszipfromrev57537trunktestsphpunitdatafilesystemarchiveubuntunautiluszip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-ubuntu-nautilus.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-ubuntu-nautilus.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchiveuncompressedzipfromrev57537trunktestsphpunitdatafilesystemarchiveuncompressedzip"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive-uncompressed.zip (from rev 57537, trunk/tests/phpunit/data/filesystem/archive-uncompressed.zip)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunitdatafilesystemarchivecrxfromrev57537trunktestsphpunitdatafilesystemarchivecrx"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/data/filesystem/archive.crx (from rev 57537, trunk/tests/phpunit/data/filesystem/archive.crx)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="branches64testsphpunittestsfilesystemwpZipFileIsValidphpfromrev57537trunktestsphpunittestsfilesystemwpZipFileIsValidphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.4/tests/phpunit/tests/filesystem/wpZipFileIsValid.php (from rev 57537, trunk/tests/phpunit/tests/filesystem/wpZipFileIsValid.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.4/tests/phpunit/tests/filesystem/wpZipFileIsValid.php                          (rev 0)
+++ branches/6.4/tests/phpunit/tests/filesystem/wpZipFileIsValid.php    2024-04-04 19:28:21 UTC (rev 57929)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,75 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/**
+ * Tests wp_zip_file_is_valid().
+ *
+ * @group file
+ * @group filesystem
+ *
+ * @covers ::wp_zip_file_is_valid
+ */
+class Tests_Filesystem_WpZipFileIsValid extends WP_UnitTestCase {
+
+       /**
+        * The test data directory.
+        *
+        * @var string $test_data_dir
+        */
+       private static $test_data_dir;
+
+       /**
+        * Sets up the filesystem and test data directory property
+        * before any tests run.
+        */
+       public static function set_up_before_class() {
+               parent::set_up_before_class();
+
+               require_once ABSPATH . 'wp-admin/includes/file.php';
+               WP_Filesystem();
+
+               self::$test_data_dir = DIR_TESTDATA . '/filesystem/';
+       }
+
+       /**
+        * Tests ZIP file validity is correctly determined.
+        *
+        * @ticket 60398
+        *
+        * @dataProvider data_zip_file_validity
+        *
+        * @param string $file     The ZIP file to test.
+        * @param bool   $expected Whether the ZIP file is expected to be valid.
+        */
+       public function test_zip_file_validity( $file, $expected ) {
+               $zip_file = self::$test_data_dir . $file;
+
+               $expected_message = $expected ? 'valid' : 'invalid';
+               $this->assertSame( $expected, wp_zip_file_is_valid( $zip_file ), "Expected archive to be {$expected_message}." );
+       }
+
+       /**
+        * Data provider.
+        *
+        * @return array[]
+        */
+       public function data_zip_file_validity() {
+               return array(
+                       'standard zip'           => array( 'archive.zip', true ),
+                       'large zip'              => array( 'archive-large.zip', true ),
+                       'commented zip'          => array( 'archive-comment.zip', true ),
+                       'cp866 zip'              => array( 'archive-cp866.zip', true ),
+                       'directory entry zip'    => array( 'archive-directory-entry.zip', true ),
+                       'encrypted zip'          => array( 'archive-encrypted.zip', true ),
+                       'flags-set zip'          => array( 'archive-flags-set.zip', true ),
+                       'uncompressed zip'       => array( 'archive-uncompressed.zip', true ),
+                       'crx zip'                => array( 'archive.crx', true ),
+                       'macos generated zip'    => array( 'archive-macos.zip', true ),
+                       'gnome generated zip'    => array( 'archive-gnome.zip', true ),
+                       'ubuntu nautilus zip'    => array( 'archive-ubuntu-nautilus.zip', true ),
+
+                       'invalid zip file'       => array( 'archive-invalid.zip', false ),
+                       'invalid file extension' => array( 'archive-invalid-ext.md', false ),
+                       'non-existent file'      => array( 'archive-non-existent.zip', false ),
+               );
+       }
+}
</ins></span></pre>
</div>
</div>

</body>
</html>