Menu

#3907 (ok 4.0.2) Static Analysis Results: Undefined variables, function parameter problems

Latest_Git
fixed
quality (1)
1
2015-03-02
2013-05-05
No

I ran the latest git master branch through hhvm --hphp -t analyze and filtered out most of the false positives. I only checked a few of these, but the ones I checked appear to be valid issues:

--------------------------------
File       : libraries/plugins/export/ExportOdt.class.php:350
Reason     : UseUndeclaredVariable
Snippet    : $table
Line       : . htmlspecialchars($table) . '_data">';
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:97
Reason     : UseUndeclaredVariable
Snippet    : $import_file
Line       : && PMA_getNoOfFilesInZip($import_file) > 1
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:96
Reason     : UseUndeclaredVariable
Snippet    : $compression
Line       : if ($compression == 'application/zip'
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:99
Reason     : UseUndeclaredVariable
Snippet    : $import_file
Line       : $zip_content =  PMA_getZipContents($import_file, '/^.*\.shp$/i');
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:108
Reason     : UseUndeclaredVariable
Snippet    : $compression
Line       : if ($compression == 'application/zip'
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:109
Reason     : UseUndeclaredVariable
Snippet    : $cfg
Line       : && ! empty($cfg['TempDir'])
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:110
Reason     : UseUndeclaredVariable
Snippet    : $cfg
Line       : && is_writable($cfg['TempDir'])
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:113
Reason     : UseUndeclaredVariable
Snippet    : $import_file
Line       : '/^.*\.dbf$/i', $import_file
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:119
Reason     : UseUndeclaredVariable
Snippet    : $import_file
Line       : $import_file,
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:120
Reason     : UseUndeclaredVariable
Snippet    : $cfg
Line       : realpath($cfg['TempDir']),
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:124
Reason     : UseUndeclaredVariable
Snippet    : $cfg
Line       : $dbf_file_path = realpath($cfg['TempDir'])
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:135
Reason     : UseUndeclaredVariable
Snippet    : $local_import_file
Line       : } elseif (! empty($local_import_file)
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:136
Reason     : UseUndeclaredVariable
Snippet    : $cfg
Line       : && ! empty($cfg['UploadDir'])
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:137
Reason     : UseUndeclaredVariable
Snippet    : $compression
Line       : && $compression == 'none'
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:143
Reason     : UseUndeclaredVariable
Snippet    : $import_file
Line       : $file_name = substr($import_file, 0, strlen($import_file) - 4)
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:143
Reason     : UseUndeclaredVariable
Snippet    : $import_file
Line       : $file_name = substr($import_file, 0, strlen($import_file) - 4)
--------------------------------
File       : libraries/plugins/import/ImportShp.class.php:162
Reason     : UseUndeclaredVariable
Snippet    : $dbf_file_path
Line       : unlink($dbf_file_path);
--------------------------------
File       : libraries/plugins/import/ImportCsv.class.php:163
Reason     : UseUndeclaredVariable
Snippet    : $err_url
Line       : PMA_Util::mysqlDie($message->getMessage(), '', '', $err_url);
--------------------------------
File       : libraries/plugins/import/ImportCsv.class.php:170
Reason     : UseUndeclaredVariable
Snippet    : $csv_replace
Line       : if (isset($csv_replace)) {
--------------------------------
File       : libraries/plugins/import/ImportCsv.class.php:174
Reason     : UseUndeclaredVariable
Snippet    : $csv_ignore
Line       : if (isset($csv_ignore)) {
--------------------------------
File       : libraries/plugins/import/ImportCsv.class.php:182
Reason     : UseUndeclaredVariable
Snippet    : $csv_columns
Line       : if (empty($csv_columns)) {
--------------------------------
File       : libraries/plugins/import/ImportCsv.class.php:187
Reason     : UseUndeclaredVariable
Snippet    : $csv_columns
Line       : $tmp   = preg_split('/,( ?)/', $csv_columns);
--------------------------------
File       : libraries/replication_gui.lib.php:368
Reason     : UseUndeclaredVariable
Snippet    : $mode
Line       : if (isset($GLOBALS['username']) && $mode != 'change') {
--------------------------------
File       : libraries/sql_query_form.lib.php:457
Reason     : UseUndeclaredVariable
Snippet    : $timeout_passed
Line       : (isset($timeout_passed) && $timeout_passed && isset($local_import_file))
--------------------------------
File       : libraries/sql_query_form.lib.php:457
Reason     : UseUndeclaredVariable
Snippet    : $timeout_passed
Line       : (isset($timeout_passed) && $timeout_passed && isset($local_import_file))
--------------------------------
File       : libraries/sql_query_form.lib.php:457
Reason     : UseUndeclaredVariable
Snippet    : $local_import_file
Line       : (isset($timeout_passed) && $timeout_passed && isset($local_import_file))
--------------------------------
File       : libraries/sql_query_form.lib.php:458
Reason     : UseUndeclaredVariable
Snippet    : $local_import_file
Line       : ? $local_import_file
--------------------------------
File       : libraries/transformations.lib.php:382
Reason     : UseUndeclaredVariable
Snippet    : $cfgRelation
Line       : if (! isset($cfgRelation['column_info'])) {
--------------------------------
File       : server_status.php:197
Reason     : UseUndeclaredVariable
Snippet    : $hour_factor
Line       : $ServerStatusData->status['Bytes_received'] * $hour_factor, 3, 1
--------------------------------
File       : server_status.php:216
Reason     : UseUndeclaredVariable
Snippet    : $hour_factor
Line       : $ServerStatusData->status['Bytes_sent'] * $hour_factor, 3, 1
--------------------------------
File       : server_status.php:236
Reason     : UseUndeclaredVariable
Snippet    : $hour_factor
Line       : * $hour_factor, 3, 1
--------------------------------
File       : server_status.php:283
Reason     : UseUndeclaredVariable
Snippet    : $hour_factor
Line       : $ServerStatusData->status['Aborted_connects'] * $hour_factor, 4, 2, true
--------------------------------
File       : server_status.php:307
Reason     : UseUndeclaredVariable
Snippet    : $hour_factor
Line       : $ServerStatusData->status['Aborted_clients'] * $hour_factor, 4, 2, true
--------------------------------
File       : server_status.php:331
Reason     : UseUndeclaredVariable
Snippet    : $hour_factor
Line       : $ServerStatusData->status['Connections'] * $hour_factor, 4, 2
--------------------------------
File       : server_status_queries.php:154
Reason     : UseUndeclaredVariable
Snippet    : $hour_factor
Line       : PMA_Util::formatNumber($value * $hour_factor, 4, 1, true)
--------------------------------
File       : libraries/plugins/import/ImportLdi.class.php:123
Reason     : UseUndeclaredVariable
Snippet    : $ldi_ignore
Line       : } elseif (isset($ldi_ignore)) {
--------------------------------
File       : libraries/rte/rte_export.lib.php:45
Reason     : UseUndeclaredVariable
Snippet    : $response
Line       : $response = PMA_message::error($response);
--------------------------------
File       : libraries/sql.lib.php:426
Reason     : UseUndeclaredVariable
Snippet    : $cfg
Line       : $cfg['ForeignKeyMaxLimit']
--------------------------------
File       : libraries/config/ConfigFile.class.php:241
Reason     : UseUndeclaredVariable
Snippet    : $current_global
Line       : || empty($current_global)))
--------------------------------
File       : libraries/dbi/mysqli.dbi.lib.php:391
Reason     : UseUndeclaredVariable
Snippet    : $link
Line       : if (empty($link)) {
--------------------------------
File       : libraries/plugins/export/ExportHtmlword.class.php:132
Reason     : UseUndeclaredVariable
Snippet    : $charsetOfFile
Line       : . (isset($charsetOfFile) ? $charsetOfFile : 'utf-8') . '" />
--------------------------------
File       : libraries/plugins/export/ExportHtmlword.class.php:132
Reason     : UseUndeclaredVariable
Snippet    : $charsetOfFile
Line       : . (isset($charsetOfFile) ? $charsetOfFile : 'utf-8') . '" />
--------------------------------
File       : libraries/plugins/export/ExportHtmlword.class.php:293
Reason     : UseUndeclaredVariable
Snippet    : $table
Line       : $keys = PMA_DBI_getTableIndexes($db, $table);
--------------------------------
File       : libraries/tcpdf/tcpdf.php:5200
Reason     : UseUndeclaredVariable
Snippet    : $type
Line       : if (isset($type)) {
--------------------------------
File       : libraries/tcpdf/tcpdf.php:5203
Reason     : UseUndeclaredVariable
Snippet    : $cw
Line       : if (isset($cw)) {
--------------------------------
File       : libraries/DisplayResults.class.php:2987
Reason     : UseUndeclaredVariable
Snippet    : $edit_url
Line       : if (isset($edit_url)) {
--------------------------------
File       : libraries/DisplayResults.class.php:2990
Reason     : UseUndeclaredVariable
Snippet    : $edit_url
Line       : $edit_url,
--------------------------------
File       : libraries/DisplayResults.class.php:3401
Reason     : UseUndeclaredVariable
Snippet    : $row
Line       : 'sql_query' => 'KILL ' . $row[0], //FIXME:variable $row is undefined
--------------------------------
File       : libraries/DisplayResults.class.php:3407
Reason     : UseUndeclaredVariable
Snippet    : $row
Line       : $js_conf  = 'KILL ' . $row[0]; //FIXME:variable $row is undefined
--------------------------------
File       : libraries/DisplayResults.class.php:3406
Reason     : UseUndeclaredVariable
Snippet    : $row
Line       : $del_query = 'KILL ' . $row[0]; //FIXME:variable $row is undefined
--------------------------------
File       : libraries/DisplayResults.class.php:5222
Reason     : UseUndeclaredVariable
Snippet    : $printview
Line       : && ! isset($printview)
--------------------------------
File       : libraries/DisplayResults.class.php:5852
Reason     : TooManyArgument
Snippet    : $this->_getCheckboxForMultiRowSubmissions($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_left', '', '', '')
Line       : $ret .= $this->_getCheckboxForMultiRowSubmissions(
--------------------------------
File       : libraries/DisplayResults.class.php:5869
Reason     : TooManyArgument
Snippet    : $this->_getDeleteLink($del_url, $del_str, $js_conf, '', '')
Line       : $ret .= $this->_getDeleteLink($del_url, $del_str, $js_conf, '', '');
--------------------------------
File       : libraries/DisplayResults.class.php:5886
Reason     : TooManyArgument
Snippet    : $this->_getCheckboxForMultiRowSubmissions($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_left', '', '', '')
Line       : $ret .= $this->_getCheckboxForMultiRowSubmissions(
--------------------------------
File       : libraries/DisplayResults.class.php:5857
Reason     : TooManyArgument
Snippet    : $this->_getEditLink($edit_url, $class, $edit_str, $where_clause, $where_clause_html, '')
Line       : $ret .= $this->_getEditLink(
--------------------------------
File       : libraries/DisplayResults.class.php:5865
Reason     : TooManyArgument
Snippet    : $this->_getDeleteLink($del_url, $del_str, $js_conf, '', '')
Line       : $ret .= $this->_getDeleteLink($del_url, $del_str, $js_conf, '', '');
--------------------------------
File       : libraries/DisplayResults.class.php:5875
Reason     : TooManyArgument
Snippet    : $this->_getEditLink($edit_url, $class, $edit_str, $where_clause, $where_clause_html, '')
Line       : $ret .= $this->_getEditLink(
--------------------------------
File       : libraries/DisplayResults.class.php:5879
Reason     : TooManyArgument
Snippet    : $this->_getCheckboxForMultiRowSubmissions($del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix = '_right', '', '', '')
Line       : $ret .= $this->_getCheckboxForMultiRowSubmissions(
--------------------------------
File       : libraries/TableSearch.class.php:484
Reason     : UseUndeclaredVariable
Snippet    : $types
Line       : $geom_funcs = PMA_Util::getGISFunctions($types, true, false);
--------------------------------
File       : libraries/dbi/dummy.lib.php:420
Reason     : UseUndeclaredVariable
Snippet    : $i
Line       : $GLOBALS['dummy_queries'][$i]['pos'] = $offset;
--------------------------------
File       : libraries/dbi/dummy.lib.php:417
Reason     : UseUndeclaredVariable
Snippet    : $i
Line       : if ($offset > count($GLOBALS['dummy_queries'][$i]['result'])) {
--------------------------------
File       : libraries/operations.lib.php:1513
Reason     : UseUndeclaredVariable
Snippet    : $auto_increment
Line       : && (! isset($auto_increment)
--------------------------------
File       : libraries/operations.lib.php:1514
Reason     : UseUndeclaredVariable
Snippet    : $auto_increment
Line       : || $_REQUEST['new_auto_increment'] !== $auto_increment)
--------------------------------
File       : libraries/schema/Visio_Relation_Schema.class.php:260
Reason     : UseUndeclaredVariable
Snippet    : $fontSize
Line       : $this->_setHeightTable($fontSize);
--------------------------------
File       : server_replication.php:297
Reason     : UseVoidReturn
Snippet    : PMA_replication_print_status_table('slave', true, false)
Line       : echo PMA_replication_print_status_table('slave', true, false);
--------------------------------
File       : libraries/sqlvalidator.class.php:385
Reason     : TooFewArgument
Snippet    : $this->_openSession($this->service_link, $this->username, $this->password, $this->calling_program, $this->calling_program_version, $this->target_dbms, $this->target_dbms_version, $this->connection_technology, $this->connection_technology_version)
Line       : $this->session_data = $this->_openSession(
--------------------------------
File       : libraries/DBQbe.class.php:1238
Reason     : TooManyArgument
Snippet    : $this->_getWhereClauseTablesAndColumns($this->_criteria)
Line       : $valid_where_clauses = $this->_getWhereClauseTablesAndColumns($this->_criteria);
--------------------------------
File       : libraries/php-gettext/gettext.inc:458
Reason     : TooManyArgument
Snippet    : _npgettext($context, $singular, $plural, $number)
Line       : return _npgettext($context, $singular, $plural, $number);
--------------------------------
File       : libraries/php-gettext/gettext.inc:465
Reason     : TooManyArgument
Snippet    : _dnpgettext($domain, $context, $singular, $plural, $number)
Line       : return _dnpgettext($domain, $context, $singular, $plural, $number);
--------------------------------
File       : libraries/php-gettext/gettext.inc:474
Reason     : TooManyArgument
Snippet    : _dcnpgettext($domain, $context, $singular, $plural, $number, $category)
Line       : return _dcnpgettext($domain, $context, $singular,
--------------------------------
File       : libraries/php-gettext/gettext.inc:517
Reason     : TooManyArgument
Snippet    : _npgettext($context, $singular, $plural, $number)
Line       : return _npgettext($context, $singular, $plural, $number);
--------------------------------
File       : libraries/php-gettext/gettext.inc:523
Reason     : TooManyArgument
Snippet    : _dnpgettext($domain, $context, $singular, $plural, $number)
Line       : return _dnpgettext($domain, $context, $singular, $plural, $number);
--------------------------------
File       : libraries/php-gettext/gettext.inc:530
Reason     : TooManyArgument
Snippet    : _dcnpgettext($domain, $context, $singular, $plural, $number, $category)
Line       : return _dcnpgettext($domain, $context, $singular, $plural,
--------------------------------
File       : server_status_advisor.php:20
Reason     : TooManyArgument
Snippet    : new PMA_ServerStatusData('server_status_advisor.php')
Line       : $ServerStatusData = new PMA_ServerStatusData('server_status_advisor.php');
--------------------------------
File       : server_status_monitor.php:293
Reason     : TooManyArgument
Snippet    : implode(' ', PMA_Util::formatByteDown(strlen($row['argument'])), 2, 2)
Line       : .  implode(
--------------------------------
File       : changelog.php:14
Reason     : UseVoidReturn
Snippet    : PMA_Response::getInstance()->disable()
Line       : $response = PMA_Response::getInstance()->disable();
--------------------------------
File       : index.php:211
Reason     : UseVoidReturn
Snippet    : PMA_printListItem(PMA_Util::getImage('b_tblops.png') . ' ' . __('More settings'), 'li_user_preferences', 'prefs_manage.php?' . $common_url_query, null, null, null, 'no_bullets')
Line       : echo PMA_printListItem(

Discussion

  • Marc Delisle

    Marc Delisle - 2013-05-11

    Thanks Rasmus, this is a pretty interesting tool and we'll look at these issues.

     
  • Marc Delisle

    Marc Delisle - 2013-05-12

    Fixed:
    $csv_replace
    $hour_factor in server_status.php

     
  • J.M. Rütter

    J.M. Rütter - 2013-05-13

    Thanks Rasmus for taking the time to run the HipHop static analysis!

    As for your findings in third-party libraries used by phpMyAdmin:

     
  • J.M. Rütter

    J.M. Rütter - 2013-05-13
    • summary: Static Analysis Results --> Static Analysis Results: Undefined variables, function parameter problems
    • assigned_to: J.M.
     
  • J.M. Rütter

    J.M. Rütter - 2013-12-27
    • labels: --> quality
    • summary: Static Analysis Results: Undefined variables, function parameter problems --> (ok 4.0.2) Static Analysis Results: Undefined variables, function parameter problems
    • status: open --> fixed
    • Priority: 5 --> 1