Skip to content

Commit

Permalink
Fix for PHP 7: remove magic_quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrael authored and cweiske committed Feb 4, 2015
1 parent 4ffe4b5 commit 1c3f55f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 21 deletions.
4 changes: 0 additions & 4 deletions PEAR/Config.php
Expand Up @@ -1022,16 +1022,12 @@ function _readConfigDataFrom($file)
}

$size = filesize($file);
$rt = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
fclose($fp);
$contents = file_get_contents($file);
if (empty($contents)) {
return $this->raiseError('Configuration file "' . $file . '" is empty');
}

set_magic_quotes_runtime($rt);

$version = false;
if (preg_match('/^#PEAR_Config\s+(\S+)\s+/si', $contents, $matches)) {
$version = $matches[1];
Expand Down
6 changes: 0 additions & 6 deletions PEAR/DependencyDB.php
Expand Up @@ -550,12 +550,9 @@ function _getDepDB()
return $err;
}

$rt = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
clearstatcache();
fclose($fp);
$data = unserialize(file_get_contents($this->_depdb));
set_magic_quotes_runtime($rt);
$this->_cache = $data;
return $data;
}
Expand All @@ -577,10 +574,7 @@ function _writeDepDB(&$deps)
return PEAR::raiseError("Could not open dependencies file `".$this->_depdb."' for writing");
}

$rt = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
fwrite($fp, serialize($deps));
set_magic_quotes_runtime($rt);
fclose($fp);
$this->_unlock();
$this->_cache = $deps;
Expand Down
9 changes: 0 additions & 9 deletions PEAR/Registry.php
Expand Up @@ -782,12 +782,9 @@ function _readFileMap()
}

clearstatcache();
$rt = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
$fsize = filesize($this->filemap);
fclose($fp);
$data = file_get_contents($this->filemap);
set_magic_quotes_runtime($rt);
$tmp = unserialize($data);
if (!$tmp && $fsize > 7) {
return $this->raiseError('PEAR_Registry: invalid filemap data', PEAR_REGISTRY_ERROR_FORMAT, null, null, $data);
Expand Down Expand Up @@ -1136,12 +1133,9 @@ function _packageInfo($package = null, $key = null, $channel = 'pear.php.net')
return null;
}

$rt = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
clearstatcache();
$this->_closePackageFile($fp);
$data = file_get_contents($this->_packageFileName($package, $channel));
set_magic_quotes_runtime($rt);
$data = unserialize($data);
if ($key === null) {
return $data;
Expand Down Expand Up @@ -1175,12 +1169,9 @@ function _channelInfo($channel, $noaliases = false)
return null;
}

$rt = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
clearstatcache();
$this->_closeChannelFile($fp);
$data = file_get_contents($this->_channelFileName($channel));
set_magic_quotes_runtime($rt);
$data = unserialize($data);
return $data;
}
Expand Down
1 change: 0 additions & 1 deletion PEAR/RunTest.php
Expand Up @@ -75,7 +75,6 @@ class PEAR_RunTest
'error_append_string=',
'auto_prepend_file=',
'auto_append_file=',
'magic_quotes_runtime=0',
'xdebug.default_enable=0',
'allow_url_fopen=1',
);
Expand Down
1 change: 0 additions & 1 deletion scripts/pearcmd.php
Expand Up @@ -41,7 +41,6 @@
ob_implicit_flush(true);
@ini_set('track_errors', true);
@ini_set('html_errors', false);
@ini_set('magic_quotes_runtime', false);
$_PEAR_PHPDIR = '#$%^&*';
set_error_handler('error_handler');

Expand Down

0 comments on commit 1c3f55f

Please sign in to comment.