Skip to content
This repository was archived by the owner on Jan 2, 2019. It is now read-only.

Add default value for $contents in getFromName() #586

Open
wants to merge 1 commit into
base: 1.8
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Classes/PHPExcel/Shared/ZipArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ public function locateName($fileName)
/**
* Extract file from archive by given fileName (Emulate ZipArchive getFromName())
*
* @param string $fileName Filename for the file in zip archive
* @return string $contents File string contents
* @access public
* @param string $fileName Filename for the file in zip archive
* @return string $contents File string contents
*/
public function getFromName($fileName)
{
Expand Down Expand Up @@ -154,6 +155,8 @@ public function getFromName($fileName)
}
$extracted = $this->zip->extractByIndex($list_index, PCLZIP_OPT_EXTRACT_AS_STRING);
}

$contents = "";
if ((is_array($extracted)) && ($extracted != 0)) {
$contents = $extracted[0]["content"];
}
Expand Down