ThinkUpLLC / ThinkUp

ThinkUp gives you insights into your social networking activity on Twitter, Facebook, Instagram, and beyond.
http://thinkup.com
GNU General Public License v3.0
3.3k stars 676 forks source link

Static Analysis Results #1592

Open rlerdorf opened 11 years ago

rlerdorf commented 11 years ago

I ran hhvm --hphp -t analyze over the code and filtered out obvious false positives and most of the 3rd-party stuff. This is what is left:

--------------------------------
File       : webapp/_lib/controller/class.ForgotPasswordController.php:51
Reason     : UseUndeclaredVariable
Snippet    : $false
Line       : $es->assign('application_url', Utils::getApplicationURL($false));
--------------------------------
File       : webapp/_lib/controller/class.DashboardController.php:324
Reason     : UseUndeclaredVariable
Snippet    : $username
Line       : $this->addErrorMessage($username." on ".ucwords($this->instance->network).
--------------------------------
File       : webapp/_lib/controller/class.SearchController.php:126
Reason     : UseUndeclaredVariable
Snippet    : $posts
Line       : if (sizeof($posts) == (self::PAGE_RESULTS_COUNT+1)) {
--------------------------------
File       : webapp/_lib/dao/class.FollowMySQLDAO.php:588
Reason     : UseUndeclaredVariable
Snippet    : $start_on_record
Line       : $vars[':start_on_record'] = (int)$start_on_record;
--------------------------------
File       : webapp/plugins/twitter/model/class.TwitterCrawler.php:283
Reason     : UseUndeclaredVariable
Snippet    : $inserted_post_key
Line       : if ($inserted_post_key !== false) {
--------------------------------
File       : webapp/plugins/twitter/model/class.TwitterCrawler.php:1089
Reason     : UseUndeclaredVariable
Snippet    : $fcount
Line       : $fcount++;
--------------------------------
File       : webapp/plugins/twitter/model/class.TwitterCrawler.php:1267
Reason     : UseUndeclaredVariable
Snippet    : $cURL_status
Line       : $status_message = "Stop fetching tweets. cURL_status = " . $cURL_status;
--------------------------------
File       : webapp/_lib/class.Installer.php:460
Reason     : UseUndeclaredVariable
Snippet    : $pass
Line       : if ( defined('TESTS_RUNNING') && TESTS_RUNNING && !empty($pass) ) {
--------------------------------
File       : webapp/_lib/class.Installer.php:461
Reason     : UseUndeclaredVariable
Snippet    : $pass
Line       : $version_met = $pass;
--------------------------------
File       : webapp/_lib/class.Installer.php:555
Reason     : TooManyArgument
Snippet    : Installer::populateTables($config, true)
Line       : $queries_logs = self::populateTables($config, true);
--------------------------------
File       : webapp/_lib/controller/class.GridController.php:102
Reason     : UseUndeclaredVariable
Snippet    : $posts_it
Line       : $posts_it;
--------------------------------
File       : webapp/_lib/controller/class.GridController.php:124
Reason     : UnknownFunction
Snippet    : Exception('Grid Search should use a PostIterator to conserve memory')
Line       : throw Exception("Grid Search should use a PostIterator to conserve memory");
--------------------------------
File       : webapp/_lib/controller/class.GridController.php:102
Reason     : StatementHasNoEffect
Snippet    : $posts_it;
Line       : $posts_it;
--------------------------------
File       : webapp/_lib/dao/class.OptionMySQLDAO.php:107
Reason     : UseUndeclaredVariable
Snippet    : $namespace
Line       : $this->clearSessionData($namespace);
--------------------------------
File       : webapp/_lib/extlib/Smarty-2.6.26/libs/plugins/function.math.php:70
Reason     : UseUndeclaredVariable
Snippet    : $smarty_math_result
Line       : return $smarty_math_result;
--------------------------------
File       : webapp/_lib/view/plugins/modifier.relative_day.php:69
Reason     : UseUndeclaredVariable
Snippet    : $ending
Line       : $text = "$difference $periods[$j] $ending ago";
--------------------------------
File       : webapp/plugins/twitter/model/class.TwitterAPIEndpoint.php:147
Reason     : UseUndeclaredVariable
Snippet    : $path
Line       : throw new Exception("Twitter API endpoint $path remaining is not set; cannot decrement");
--------------------------------
File       : webapp/plugins/twitterrealtime/model/class.StreamMasterCollect.php:236
Reason     : UseUndeclaredVariable
Snippet    : $plugins
Line       : return $plugins;
--------------------------------
File       : webapp/plugins/twitterrealtime/model/class.TwitterJSONStreamParser.php:138
Reason     : UseUndeclaredVariable
Snippet    : $u
Line       : . $u->user_id, __METHOD__.','.__LINE__);
--------------------------------
File       : extras/wordpress/thinkup/classes/ThinkUpUser.class.php:211
Reason     : TooFewArgument
Snippet    : ThinkUpShortcodeHandler::getShortcodeAtts()
Line       : $atts = ThinkUpShortcodeHandler::getShortcodeAtts();
--------------------------------
File       : extras/wordpress/thinkup/classes/ThinkUpUser.class.php:227
Reason     : TooFewArgument
Snippet    : ThinkUpShortcodeHandler::getShortcodeAtts()
Line       : $atts = ThinkUpShortcodeHandler::getShortcodeAtts();
--------------------------------
File       : extras/wordpress/thinkup/classes/ThinkUpUser.class.php:289
Reason     : TooFewArgument
Snippet    : ThinkUpShortcodeHandler::getShortcodeAtts()
Line       : $atts = ThinkUpShortcodeHandler::getShortcodeAtts();
--------------------------------
File       : webapp/plugins/twitterrealtime/extlib/predis/lib/Predis.php:250
Reason     : BadConstructorCall
Snippet    : new Predis\Pipeline\SafeExecutor($connection)
Line       : ? new Pipeline\SafeExecutor($connection)
--------------------------------
File       : webapp/plugins/twitterrealtime/extlib/predis/lib/Predis.php:251
Reason     : BadConstructorCall
Snippet    : new Predis\Pipeline\SafeClusterExecutor($connection)
Line       : : new Pipeline\SafeClusterExecutor($connection)
--------------------------------
File       : webapp/_lib/dao/class.PostMySQLDAO.php:1461
Reason     : RequiredAfterOptionalParam
Snippet    : $network = 'twitter'
Line       : public function getAllMentionsInRange($author_username, $count, $network = "twitter", $from, $until, $page=1,
--------------------------------
File       : webapp/_lib/dao/interface.PostDAO.php:375
Reason     : RequiredAfterOptionalParam
Snippet    : $network = 'twitter'
Line       : public function getAllMentionsInRange($author_username, $count, $network = "twitter", $from, $until, $page=1,
--------------------------------
File       : webapp/_lib/class.ViewManager.php:184
Reason     : TooManyArgument
Snippet    : $this->addMessage(2, $msg, $field, $disable_xss)
Line       : $this->addMessage(self::INFO_MESSAGE, $msg, $field, $disable_xss);
--------------------------------
File       : webapp/_lib/class.ViewManager.php:197
Reason     : TooManyArgument
Snippet    : $this->addMessage(1, $msg, $field, $disable_xss)
Line       : $this->addMessage(self::SUCCESS_MESSAGE, $msg, $field, $disable_xss);
--------------------------------
File       : webapp/_lib/controller/class.ExportServiceUserDataController.php:202
Reason     : StatementHasNoEffect
Snippet    : ' pages) authored by ' . $username . ' on ' . $service . '<br>';
Line       : " pages) authored by ". $username." on ".$service."<br>";
--------------------------------
File       : webapp/_lib/dao/class.InstallerMySQLDAO.php:201
Reason     : StatementHasNoEffect
Snippet    : $rollback_match;
Line       : $rollback_match;
ginatrapani commented 11 years ago

Wow, very useful. Much to fix and clean up here. Thank you.