From aee274ada10542275495f3368987573c434b6223 Mon Sep 17 00:00:00 2001 From: Xuefer Date: Wed, 10 Jul 2013 07:13:14 +0000 Subject: [PATCH] phpdc: exit on decompile error git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1285 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- bin/phpdc.phpr | 10 +++++++--- lib/Decompiler.class.php | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/phpdc.phpr b/bin/phpdc.phpr index e90fc28..969cbb5 100755 --- a/bin/phpdc.phpr +++ b/bin/phpdc.phpr @@ -14,10 +14,12 @@ if (!isset($argv)) { $dc = new Decompiler(); if (isset($argv[2])) { - eval('$dc->dc = ' . file_get_contents($argv[2]) . ';'); + eval('$dc->decompileDasm(' . file_get_contents($argv[2]) . ');'); } else if (isset($argv[1])) { - $dc->decompileFile($argv[1]); + if ($dc->decompileFile($argv[1]) === false) { + exit(2); + } } else { $phpcode = ''; @@ -27,7 +29,9 @@ else { while (!feof(stdin)) { $phpcode .= fgets(stdin); } - $dc->decompileString($phpcode); + if ($dc->decompileString($phpcode) === false) { + exit(2); + } } $dc->output(); diff --git a/lib/Decompiler.class.php b/lib/Decompiler.class.php index f78d59d..c0a2272 100644 --- a/lib/Decompiler.class.php +++ b/lib/Decompiler.class.php @@ -2568,6 +2568,7 @@ class Decompiler echo "error compling string\n"; return false; } + return true; } // }}} function decompileFile($file) // {{{ @@ -2577,11 +2578,13 @@ class Decompiler echo "error compling $file\n"; return false; } + return true; } // }}} function decompileDasm($content) // {{{ { $this->dc = $content; + return true; } // }}} function output() // {{{