-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathtest.php
42 lines (36 loc) · 1.2 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
error_reporting(E_ALL);
require __DIR__ . '/../vendor/autoload.php';
define('SAMPLE_DIR', __DIR__ . '/samples');
$filenames = scandir(SAMPLE_DIR);
$filenames = array_values(array_diff($filenames, ['.', '..']));
foreach ($filenames as $key => $filename) {
$path = SAMPLE_DIR . '/' . $filename;
echo $path, PHP_EOL;
$code = file_get_contents($path);
try {
$code = \Ganlv\EnphpDecoder\AutoDecoder::decode($code);
echo $code, PHP_EOL;
} catch (Exception $e) {
echo $e->getTraceAsString();
exit(1);
}
}
define('BUG_SAMPLE_DIR', __DIR__ . '/bug_samples');
$filenames = scandir(BUG_SAMPLE_DIR);
$filenames = array_values(array_diff($filenames, ['.', '..']));
foreach ($filenames as $key => $filename) {
$path = BUG_SAMPLE_DIR . '/' . $filename;
echo $path, PHP_EOL;
$code = file_get_contents($path);
try {
$code = \Ganlv\EnphpDecoder\AutoDecoder::decode($code);
echo $code, PHP_EOL;
exit(3);
} catch (\Ganlv\EnphpDecoder\KnownEnphpBugs\KnownEnphpBugsException $e) {
echo 'KnownEnphpBugsException: ', $e->getMessage(), PHP_EOL;
} catch (Exception $e) {
echo $e->getTraceAsString();
exit(2);
}
}