Skip to content

Commit

Permalink
MDL-70631 files: Replace hard-coded value with FL_ENC_RAW constant
Browse files Browse the repository at this point in the history
This is not related to the issue but I noticed it while trying to debug
it.

Back when this line was introduced in 9c140a6, the ZipArchive had
not yet exposed this flag as a constant. It was added later with PHP
7.0.8 and we can switch to using it now.
  • Loading branch information
mudrd8mz committed Feb 3, 2021
1 parent b227b6e commit 6109e8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/filestorage/zip_archive.php
Expand Up @@ -292,9 +292,9 @@ public function get_info($index) {
return false;
}

// PHP 5.6 introduced encoding guessing logic, we need to fall back
// to raw ZIP_FL_ENC_RAW (== 64) to get consistent results as in PHP 5.5.
$result = $this->za->statIndex($index, 64);
// PHP 5.6 introduced encoding guessing logic for file names. To keep consistent behaviour with older versions,
// we fall back to obtaining file names as raw unmodified strings.
$result = $this->za->statIndex($index, ZipArchive::FL_ENC_RAW);

if ($result === false) {
return false;
Expand Down

0 comments on commit 6109e8b

Please sign in to comment.