I am using Ziparchive to extract information from APK file. (I am using php-apk-parser from github)
While most of the apks works fine some of them breaks with this error "ZipArchive::extractTo(): Invalid or uninitialized Zip object".
I can open same APK file WinRar without any errors. PS: I am running application on Windows server.
File1---->>>>>>>>>>
/* ApkParser use for apk extract to get packag detail */
$apk = new \ApkParser\Parser($tmpfilepath);
----------->
This Parser calls the Ziparchive and extends its with few functions.
class Archive extends \ZipArchive
{
/**
* @var string
*/
private $filePath;
/**
* @var string
*/
private $fileName;
/**
* @param bool $file
* @throws \Exception
*/
public function __construct($file)
{
if ($file && is_file($file)) {
$x= $this->open($file);
if ($x== true)
{
$target = "C:\out";
$this->extractTo($target);
$this->close();
}
$this->fileName = basename($this->filePath = $file);
} else {
throw new \Exception($file . " not a regular file");
}
}
Now the Out folder is empty whenever I am getting the error:
Error Image: http://take.ms/Wwv3J