Skip to content

Commit 9e2f8ad

Browse files
committed
Check variable type in decode()
1 parent 5a61ccc commit 9e2f8ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mo2array.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33

44
class mo2array {
55
const MO2ARRAY_VERSION_MAJOR = 3;
6-
const MO2ARRAY_VERSION_MINOR = 1;
6+
const MO2ARRAY_VERSION_MINOR = 2;
77

88
const MO_MAGIC_WORD_BE = "950412de";
99
const MO_MAGIC_WORD_LE = "de120495";
1010
const MO_SIZEOF_HEADER = 28;
1111

1212
public static function decode($mo, $throw = false): array|false {
13+
if (!is_string($mo))
14+
throw new \Exception("File must be supplied as a string.");
15+
1316
$array = array();
1417
$length = strlen($mo);
1518
$big_endian = null;

0 commit comments

Comments
 (0)