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

PHP 7 support #164

Closed
kitminsk opened this issue Jun 26, 2018 · 2 comments
Closed

PHP 7 support #164

kitminsk opened this issue Jun 26, 2018 · 2 comments

Comments

@kitminsk
Copy link

kitminsk commented Jun 26, 2018

The codebase should be refactored to meet PHP 7 requirements.
I think that using of mysql extension should be stopped and we need to switch to MySQLi or PDO_MySQL
The php7mar report is the following:
`#### /getid3/extension.cache.mysql.php

  • deprecatedFunctions
  • Line 82: $this->connection = mysql_pconnect($host, $username, $password);
  • Line 84: throw new Exception('mysql_pconnect() failed - check permissions and spelling.');
  • Line 87: if (!mysql_select_db($database, $this->connection)) {
  • Line 97: $SQLquery .= ' FROM \'.mysql_real_escape_string($this->table).'`';`
  • Line 98: $SQLquery .= ' WHERE (\filename` = ''.mysql_real_escape_string(getID3::VERSION).'')';`
  • Line 102: if ($this->cursor = mysql_query($SQLquery, $this->connection)) {
  • Line 103: list($version) = mysql_fetch_array($this->cursor);
  • Line 112: $this->cursor = mysql_query('DELETE FROM \'.mysql_real_escape_string($this->table).'`', $this->connection);`
  • Line 113: $this->cursor = mysql_query('INSERT INTO \'.mysql_real_escape_string($this->table).'` VALUES (''.getID3::VERSION.'', -1, -1, -1, ''.getID3::VERSION.'')', $this->connection);`
  • Line 123: $SQLquery .= ' FROM \'.mysql_real_escape_string($this->table).'`';`
  • Line 124: $SQLquery .= ' WHERE (\filename` = ''.mysql_real_escape_string($filename).'')';`
  • Line 125: $SQLquery .= ' AND (\filesize` = ''.mysql_real_escape_string($filesize).'')';`
  • Line 126: $SQLquery .= ' AND (\filetime` = ''.mysql_real_escape_string($filetime).'')';`
  • Line 127: $this->cursor = mysql_query($SQLquery, $this->connection);
  • Line 128: if (mysql_num_rows($this->cursor) > 0) {
  • Line 130: list($result) = mysql_fetch_array($this->cursor);
  • Line 138: $SQLquery = 'INSERT INTO \'.mysql_real_escape_string($this->table).'` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES (';`
  • Line 139: $SQLquery .= '\''.mysql_real_escape_string($filename).'\'';
  • Line 140: $SQLquery .= ', \''.mysql_real_escape_string($filesize).'\'';
  • Line 141: $SQLquery .= ', \''.mysql_real_escape_string($filetime).'\'';
  • Line 142: $SQLquery .= ', \''.mysql_real_escape_string(time() ).'\'';
  • Line 143: $SQLquery .= ', \''.mysql_real_escape_string(base64_encode(serialize($analysis))).'\')';
  • Line 144: $this->cursor = mysql_query($SQLquery, $this->connection);
  • Line 150: $SQLquery = 'CREATE TABLE IF NOT EXISTS \'.mysql_real_escape_string($this->table).'` (';`
  • Line 157: $this->cursor = mysql_query($SQLquery, $this->connection);
  • Line 158: echo mysql_error($this->connection);
@StudioMaX
Copy link
Collaborator

Which version are you using (getID3::VERSION)?
Please try the latest version from the master branch or 2.0 branch (there are support for namespaces, etc. 2.0 is not the official version and all changes are going to 1.x, which are then backported to 2.0).
If you look at the files in your report, you will notice that they are used to support older versions of PHP (like 5.3) and just a false positives.
extension.cache.mysql.php will be used only if you want it (also you can use extension.cache.mysqli.php or extension.cache.sqlite3.php).

@kitminsk
Copy link
Author

@StudioMaX Thanks for comment.

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