Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Analysis Results #1592

Open
rlerdorf opened this issue May 5, 2013 · 1 comment
Open

Static Analysis Results #1592

rlerdorf opened this issue May 5, 2013 · 1 comment

Comments

@rlerdorf
Copy link

rlerdorf commented May 5, 2013

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
Copy link
Member

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

ginatrapani added a commit that referenced this issue May 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants