perftools / xhgui

Web interface for XHProf profiling data can store data in MongoDB or PDO database
1.65k stars 342 forks source link

Import: require input to be parsed properly #378

Closed glensc closed 3 years ago

glensc commented 3 years ago

Do not call saver if input is not in expected format (array).

Fixes ugly error given in response:

<br />
<b>Fatal error</b>:  Uncaught TypeError: Argument 1 passed to XHGui\Saver\MongoSaver::save() must be of the type array, null given, called in /var/www/xhgui/src/Xhgui/Controller/ImportController.php on line 57 and defined in /var/www/xhgui/src/Xhgui/Saver/MongoSaver.php:21
Stack trace:
#0 /var/www/xhgui/src/Xhgui/Controller/ImportController.php(57): XHGui\Saver\MongoSaver-&gt;save(NULL)
#1 /var/www/xhgui/src/Xhgui/Controller/ImportController.php(33): XHGui\Controller\ImportController-&gt;runImport(Object(Slim\Http\Request))
#2 /var/www/xhgui/src/routes.php(150): XHGui\Controller\ImportController-&gt;import(Object(Slim\Http\Request), Object(Slim\Http\Response))
#3 [internal function]: {closure}()
#4 /var/www/xhgui/vendor/slim/slim/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)
#5 /var/www/xhgui/vendor/slim/slim/Slim/Slim.php(1355): Slim\Route-&gt;dispatch()
#6 /var/www/xhgui/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim-&gt;call()
#7 /var/www/xhgui/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middl in <b>/var/www/xhgui/src/Xhgui/Saver/MongoSaver.php</b> on line <b>21</b><br />
glensc commented 3 years ago

rebase after https://github.com/perftools/xhgui/pull/379 merge