Skip to content

Commit

Permalink
Check variable types in add()
Browse files Browse the repository at this point in the history
  • Loading branch information
xenocrat committed Aug 27, 2023
1 parent d99b42f commit c466bc7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion var2zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@

class var2zip {
const VAR2ZIP_VERSION_MAJOR = 3;
const VAR2ZIP_VERSION_MINOR = 2;
const VAR2ZIP_VERSION_MINOR = 3;
const MSDOS_EPOCH = 315532800;

public $compression_level = 6;

private $entries = array();

public function add($name, $contents, $modified = null): int {
if (!is_string($name))
throw new \Exception("Name must be a string.");

if (!is_string($contents))
throw new \Exception("Entry must be supplied as a string.");

$name = str_replace(array("\\", "/"), "", $name);

if (count($this->entries) == 0xffff)
Expand Down

0 comments on commit c466bc7

Please sign in to comment.