diff --git a/.drone.yml b/.drone.yml
index 86f569ce6d558..f570a004bd27d 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -440,6 +440,6 @@ trigger:
---
kind: signature
-hmac: a05750860b3948b9053243ce5fd1f218adf33e96221a4a9401782b8c2d1e63bb
+hmac: 824f98a6e4e05eea6d469af34ea3c9f9a47649b4fdda22438df692e3958d60fe
...
diff --git a/composer.json b/composer.json
index 9a04543e55de3..46985de08e3e5 100644
--- a/composer.json
+++ b/composer.json
@@ -103,6 +103,7 @@
"phpunit/phpunit": "^8.5",
"friendsofphp/php-cs-fixer": "^3.0",
"squizlabs/php_codesniffer": "~3.0",
+ "phpcompatibility/phpcompatibility-joomla":"^2",
"joomla-projects/joomla-browser": "~4.0",
"codeception/codeception": "~4.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
diff --git a/composer.lock b/composer.lock
index 91d0087f33693..70037fab1e3d6 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "f82efa3cb4256885752401c56198450d",
+ "content-hash": "a9c465b517f91496c2e5383670f8021a",
"packages": [
{
"name": "algo26-matthias/idna-convert",
@@ -9501,6 +9501,303 @@
},
"time": "2022-10-11T11:49:44+00:00"
},
+ {
+ "name": "phpcompatibility/php-compatibility",
+ "version": "9.3.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3",
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
+ },
+ "conflict": {
+ "squizlabs/php_codesniffer": "2.6.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "homepage": "https://github.com/wimg",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "homepage": "https://github.com/jrfnl",
+ "role": "lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
+ }
+ ],
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
+ "keywords": [
+ "compatibility",
+ "phpcs",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibility"
+ },
+ "time": "2019-12-27T09:44:58+00:00"
+ },
+ {
+ "name": "phpcompatibility/phpcompatibility-joomla",
+ "version": "2.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityJoomla.git",
+ "reference": "9143bd858fe79991925d1fe50bc6dc13f4c282ba"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityJoomla/zipball/9143bd858fe79991925d1fe50bc6dc13f4c282ba",
+ "reference": "9143bd858fe79991925d1fe50bc6dc13f4c282ba",
+ "shasum": ""
+ },
+ "require": {
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0",
+ "phpcompatibility/phpcompatibility-symfony": "^1.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "lead"
+ },
+ {
+ "name": "Michael Babker",
+ "role": "Joomla specialist"
+ }
+ ],
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by Joomla.",
+ "homepage": "http://phpcompatibility.com/",
+ "keywords": [
+ "compatibility",
+ "joomla",
+ "phpcs",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityJoomla/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityJoomla"
+ },
+ "time": "2021-02-15T13:18:46+00:00"
+ },
+ {
+ "name": "phpcompatibility/phpcompatibility-paragonie",
+ "version": "1.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
+ "reference": "ddabec839cc003651f2ce695c938686d1086cf43"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43",
+ "reference": "ddabec839cc003651f2ce695c938686d1086cf43",
+ "shasum": ""
+ },
+ "require": {
+ "phpcompatibility/php-compatibility": "^9.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
+ "paragonie/random_compat": "dev-master",
+ "paragonie/sodium_compat": "dev-master"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "lead"
+ }
+ ],
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
+ "homepage": "http://phpcompatibility.com/",
+ "keywords": [
+ "compatibility",
+ "paragonie",
+ "phpcs",
+ "polyfill",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
+ },
+ "time": "2021-02-15T10:24:51+00:00"
+ },
+ {
+ "name": "phpcompatibility/phpcompatibility-passwordcompat",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat.git",
+ "reference": "560e1b45f7ad5ba634ad37820da155ec49f8f272"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityPasswordCompat/zipball/560e1b45f7ad5ba634ad37820da155ec49f8f272",
+ "reference": "560e1b45f7ad5ba634ad37820da155ec49f8f272",
+ "shasum": ""
+ },
+ "require": {
+ "phpcompatibility/php-compatibility": "^9.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
+ "ircmaxell/password-compat": "dev-master"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "lead"
+ }
+ ],
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by ircmaxell's password_compat library.",
+ "homepage": "http://phpcompatibility.com/",
+ "keywords": [
+ "compatibility",
+ "password_compat",
+ "phpcs",
+ "polyfill",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat"
+ },
+ "time": "2021-02-15T09:51:58+00:00"
+ },
+ {
+ "name": "phpcompatibility/phpcompatibility-symfony",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilitySymfony.git",
+ "reference": "36ca92b3cc547c08597bae06da23167449239b45"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilitySymfony/zipball/36ca92b3cc547c08597bae06da23167449239b45",
+ "reference": "36ca92b3cc547c08597bae06da23167449239b45",
+ "shasum": ""
+ },
+ "require": {
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0",
+ "phpcompatibility/phpcompatibility-passwordcompat": "^1.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
+ "symfony/polyfill-php54": "1.19",
+ "symfony/polyfill-php55": "1.19",
+ "symfony/polyfill-php56": "1.19",
+ "symfony/polyfill-php70": "1.19",
+ "symfony/polyfill-php71": "1.19",
+ "symfony/polyfill-php72": "dev-main",
+ "symfony/polyfill-php73": "dev-main",
+ "symfony/polyfill-php74": "dev-main",
+ "symfony/polyfill-php80": "dev-main"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "lead"
+ }
+ ],
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Symfony polyfill libraries.",
+ "homepage": "http://phpcompatibility.com/",
+ "keywords": [
+ "compatibility",
+ "phpcs",
+ "polyfill",
+ "standards",
+ "symfony"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilitySymfony/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilitySymfony"
+ },
+ "time": "2021-02-16T11:31:55+00:00"
+ },
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
diff --git a/libraries/src/Filesystem/Stream.php b/libraries/src/Filesystem/Stream.php
index ed2cbc4631fea..08c693ce1cd87 100644
--- a/libraries/src/Filesystem/Stream.php
+++ b/libraries/src/Filesystem/Stream.php
@@ -241,8 +241,6 @@ public function open(
// Capture PHP errors
$php_errormsg = 'Error Unknown whilst opening a file';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
// Decide which context to use:
switch ($this->processingmethod) {
@@ -279,9 +277,6 @@ public function open(
$retval = true;
}
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
// Return the result
return $retval;
}
@@ -308,8 +303,6 @@ public function close()
// Capture PHP errors
$php_errormsg = 'Error Unknown';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
switch ($this->processingmethod) {
case 'gz':
@@ -339,9 +332,6 @@ public function close()
$this->chmod();
}
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
// Return the result
return $retval;
}
@@ -361,11 +351,6 @@ public function eof()
return false;
}
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
switch ($this->processingmethod) {
case 'gz':
$res = gzeof($this->fh);
@@ -378,13 +363,6 @@ public function eof()
break;
}
- if ($php_errormsg) {
- $this->setError($php_errormsg);
- }
-
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
// Return the result
return $res;
}
@@ -405,32 +383,14 @@ public function filesize()
}
$retval = false;
-
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
$res = @filesize($this->filename);
if (!$res) {
- $tmp_error = '';
-
- if ($php_errormsg) {
- // Something went wrong.
- // Store the error in case we need it.
- $tmp_error = $php_errormsg;
- }
-
$res = FilesystemHelper::remotefsize($this->filename);
if (!$res) {
- if ($tmp_error) {
- // Use the php_errormsg from before
- $this->setError($tmp_error);
- } else {
- // Error but nothing from php? How strange! Create our own
- $this->setError(Text::_('JLIB_FILESYSTEM_ERROR_STREAMS_FILE_SIZE'));
- }
+ // Error but nothing from php? How strange! Create our own
+ $this->setError(Text::_('JLIB_FILESYSTEM_ERROR_STREAMS_FILE_SIZE'));
} else {
$this->filesize = $res;
$retval = $res;
@@ -440,9 +400,6 @@ public function filesize()
$retval = $res;
}
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
-
// Return the result
return $retval;
}
@@ -468,8 +425,6 @@ public function gets($length = 0)
// Capture PHP errors
$php_errormsg = 'Error Unknown';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
switch ($this->processingmethod) {
case 'gz':
@@ -489,9 +444,6 @@ public function gets($length = 0)
$retval = $res;
}
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
// Return the result
return $retval;
}
@@ -532,8 +484,6 @@ public function read($length = 0)
// Capture PHP errors
$php_errormsg = 'Error Unknown';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
$remaining = $length;
do {
@@ -576,9 +526,6 @@ public function read($length = 0)
}
} while ($remaining || !$length);
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
// Return the result
return $retval;
}
@@ -606,11 +553,6 @@ public function seek($offset, $whence = SEEK_SET)
$retval = false;
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
switch ($this->processingmethod) {
case 'gz':
$res = gzseek($this->fh, $offset, $whence);
@@ -625,14 +567,11 @@ public function seek($offset, $whence = SEEK_SET)
// Seek, interestingly, returns 0 on success or -1 on failure.
if ($res == -1) {
- $this->setError($php_errormsg);
+ $this->setError('');
} else {
$retval = true;
}
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
// Return the result
return $retval;
}
@@ -652,11 +591,6 @@ public function tell()
return false;
}
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
switch ($this->processingmethod) {
case 'gz':
$res = gztell($this->fh);
@@ -671,12 +605,9 @@ public function tell()
// May return 0 so check if it's really false
if ($res === false) {
- $this->setError($php_errormsg);
+ $this->setError('');
}
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
// Return the result
return $res;
}
@@ -720,11 +651,6 @@ public function write(&$string, $length = 0, $chunk = 0)
}
$retval = true;
-
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
$remaining = $length;
$start = 0;
@@ -736,7 +662,7 @@ public function write(&$string, $length = 0, $chunk = 0)
// Returns false on error or the number of bytes written
if ($res === false) {
// Returned error
- $this->setError($php_errormsg);
+ $this->setError('');
$retval = false;
$remaining = 0;
} elseif ($res === 0) {
@@ -750,9 +676,6 @@ public function write(&$string, $length = 0, $chunk = 0)
}
} while ($remaining);
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
-
// Return the result
return $retval;
}
@@ -786,10 +709,6 @@ public function chmod($filename = '', $mode = 0)
$retval = false;
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
$sch = parse_url($filename, PHP_URL_SCHEME);
// Scheme specific options; ftp's chmod support is fun.
@@ -806,14 +725,11 @@ public function chmod($filename = '', $mode = 0)
// Seek, interestingly, returns 0 on success or -1 on failure
if (!$res) {
- $this->setError($php_errormsg);
+ $this->setError('');
} else {
$retval = true;
}
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
-
// Return the result
return $retval;
}
@@ -940,16 +856,11 @@ public function applyContextToStream()
if ($this->fh) {
// Capture PHP errors
$php_errormsg = 'Unknown error setting context option';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
$retval = @stream_context_set_option($this->fh, $this->contextOptions);
if (!$retval) {
$this->setError($php_errormsg);
}
-
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
}
return $retval;
@@ -973,21 +884,13 @@ public function appendFilter($filterName, $readWrite = STREAM_FILTER_READ, $para
$res = false;
if ($this->fh) {
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
$res = @stream_filter_append($this->fh, $filterName, $readWrite, $params);
- if (!$res && $php_errormsg) {
- $this->setError($php_errormsg);
+ if (!$res) {
+ $this->setError('');
} else {
$this->filters[] = &$res;
}
-
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
}
return $res;
@@ -1010,22 +913,15 @@ public function prependFilter($filterName, $readWrite = STREAM_FILTER_READ, $par
$res = false;
if ($this->fh) {
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
$res = @stream_filter_prepend($this->fh, $filterName, $readWrite, $params);
- if (!$res && $php_errormsg) {
+ if (!$res) {
// Set the error msg
- $this->setError($php_errormsg);
+ $this->setError('');
} else {
array_unshift($res, '');
$res[0] = &$this->filters;
}
-
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
}
return $res;
@@ -1044,24 +940,16 @@ public function prependFilter($filterName, $readWrite = STREAM_FILTER_READ, $par
*/
public function removeFilter(&$resource, $byindex = false)
{
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
if ($byindex) {
$res = stream_filter_remove($this->filters[$resource]);
} else {
$res = stream_filter_remove($resource);
}
- if ($res && $php_errormsg) {
- $this->setError($php_errormsg);
+ if ($res) {
+ $this->setError('');
}
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
-
return $res;
}
@@ -1080,11 +968,6 @@ public function removeFilter(&$resource, $byindex = false)
*/
public function copy($src, $dest, $context = null, $usePrefix = true, $relative = false)
{
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
$chmodDest = $this->_getFilename($dest, 'w', $usePrefix, $relative);
// Since we're going to open the file directly we need to get the filename.
@@ -1103,15 +986,12 @@ public function copy($src, $dest, $context = null, $usePrefix = true, $relative
$res = @copy($src, $dest);
}
- if (!$res && $php_errormsg) {
- $this->setError($php_errormsg);
+ if (!$res) {
+ $this->setError('');
} else {
$this->chmod($chmodDest);
}
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
return $res;
}
@@ -1130,12 +1010,7 @@ public function copy($src, $dest, $context = null, $usePrefix = true, $relative
*/
public function move($src, $dest, $context = null, $usePrefix = true, $relative = false)
{
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
- $src = $this->_getFilename($src, 'w', $usePrefix, $relative);
+ $src = $this->_getFilename($src, 'w', $usePrefix, $relative);
$dest = $this->_getFilename($dest, 'w', $usePrefix, $relative);
if ($context) {
@@ -1149,15 +1024,12 @@ public function move($src, $dest, $context = null, $usePrefix = true, $relative
$res = @rename($src, $dest);
}
- if (!$res && $php_errormsg) {
- $this->setError($php_errormsg());
+ if (!$res) {
+ $this->setError('');
}
$this->chmod($dest);
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
return $res;
}
@@ -1175,11 +1047,6 @@ public function move($src, $dest, $context = null, $usePrefix = true, $relative
*/
public function delete($filename, $context = null, $usePrefix = true, $relative = false)
{
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
$filename = $this->_getFilename($filename, 'w', $usePrefix, $relative);
if ($context) {
@@ -1193,13 +1060,10 @@ public function delete($filename, $context = null, $usePrefix = true, $relative
$res = @unlink($filename);
}
- if (!$res && $php_errormsg) {
- $this->setError($php_errormsg());
+ if (!$res) {
+ $this->setError('');
}
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
-
return $res;
}
diff --git a/libraries/src/Http/Transport/SocketTransport.php b/libraries/src/Http/Transport/SocketTransport.php
index d3df46d0a0c2e..2d6a75adf0150 100644
--- a/libraries/src/Http/Transport/SocketTransport.php
+++ b/libraries/src/Http/Transport/SocketTransport.php
@@ -229,30 +229,14 @@ protected function connect(UriInterface $uri, $timeout = null)
$timeout = ini_get('default_socket_timeout');
}
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
// PHP sends a warning if the uri does not exists; we silence it and throw an exception instead.
// Attempt to connect to the server
$connection = @fsockopen($host, $port, $errno, $err, $timeout);
if (!$connection) {
- if (!$php_errormsg) {
- // Error but nothing from php? Create our own
- $php_errormsg = sprintf('Could not connect to resource %s: %s (error code %d)', $uri, $err, $errno);
- }
-
- // Restore error tracking to give control to the exception handler
- ini_set('track_errors', $track_errors);
-
- throw new \RuntimeException($php_errormsg);
+ throw new \RuntimeException(sprintf('Could not connect to resource %s: %s (error code %d)', $uri, $err, $errno));
}
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
-
// Since the connection was successful let's store it in case we need to use it later.
$this->connections[$key] = $connection;
diff --git a/libraries/src/Http/Transport/StreamTransport.php b/libraries/src/Http/Transport/StreamTransport.php
index baebbc524a4ae..4dbb4f3d14908 100644
--- a/libraries/src/Http/Transport/StreamTransport.php
+++ b/libraries/src/Http/Transport/StreamTransport.php
@@ -142,29 +142,13 @@ public function request($method, UriInterface $uri, $data = null, array $headers
$uri->setPass($this->getOption('passwordauth'));
}
- // Capture PHP errors
- $php_errormsg = '';
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
// Open the stream for reading.
$stream = @fopen((string) $uri, 'r', false, $context);
if (!$stream) {
- if (!$php_errormsg) {
- // Error but nothing from php? Create our own
- $php_errormsg = sprintf('Could not connect to resource: %s', $uri);
- }
-
- // Restore error tracking to give control to the exception handler
- ini_set('track_errors', $track_errors);
-
- throw new \RuntimeException($php_errormsg);
+ throw new \RuntimeException(sprintf('Could not connect to resource: %s', $uri));
}
- // Restore error tracking to what it was before.
- ini_set('track_errors', $track_errors);
-
// Get the metadata for the stream, including response headers.
$metadata = stream_get_meta_data($stream);
diff --git a/libraries/src/Installer/InstallerHelper.php b/libraries/src/Installer/InstallerHelper.php
index ee90ea1300c9d..f9a7c3d77fac3 100644
--- a/libraries/src/Installer/InstallerHelper.php
+++ b/libraries/src/Installer/InstallerHelper.php
@@ -68,10 +68,6 @@ abstract class InstallerHelper
*/
public static function downloadPackage($url, $target = false)
{
- // Capture PHP errors
- $track_errors = ini_get('track_errors');
- ini_set('track_errors', true);
-
// Set user agent
$version = new Version();
ini_set('user_agent', $version->getUserAgent('Installer'));
@@ -121,9 +117,6 @@ public static function downloadPackage($url, $target = false)
// Write buffer to file
File::write($target, $response->body);
- // Restore error tracking to what it was before
- ini_set('track_errors', $track_errors);
-
// Bump the max execution time because not using built in php zip libs are slow
@set_time_limit(ini_get('max_execution_time'));
diff --git a/libraries/src/Language/LanguageHelper.php b/libraries/src/Language/LanguageHelper.php
index 0a818f4a78ca9..b5ae05e0d7872 100644
--- a/libraries/src/Language/LanguageHelper.php
+++ b/libraries/src/Language/LanguageHelper.php
@@ -404,15 +404,6 @@ public static function parseIniFile($fileName, $debug = false)
return [];
}
- // Capture hidden PHP errors from the parsing.
- if ($debug === true) {
- // See https://www.php.net/manual/en/reserved.variables.phperrormsg.php
- $php_errormsg = null;
-
- $trackErrors = ini_get('track_errors');
- ini_set('track_errors', true);
- }
-
// This was required for https://github.com/joomla/joomla-cms/issues/17198 but not sure what server setup
// issue it is solving
$disabledFunctions = explode(',', ini_get('disable_functions'));
@@ -425,11 +416,6 @@ public static function parseIniFile($fileName, $debug = false)
$strings = @parse_ini_file($fileName);
}
- // Restore error tracking to what it was before.
- if ($debug === true) {
- ini_set('track_errors', $trackErrors);
- }
-
return \is_array($strings) ? $strings : [];
}
diff --git a/ruleset.xml b/ruleset.xml
index 63d3e00a30b5f..43d6b7e0e8645 100644
--- a/ruleset.xml
+++ b/ruleset.xml
@@ -20,6 +20,32 @@
+
+ libraries/src/Encrypt/AES/Mcrypt\.php
+
+
+
+
+ libraries/src/Object/CMSObject\.php
+ libraries/src/String/PunycodeHelper\.php
+ tests/Unit/Libraries/Cms/Object/CMSObjectTest\.php
+
+
+
+ libraries/src/Authentication/Password/Argon2idHandler\.php
+
+
+
+ libraries/src/Date/Date\.php
+ libraries/src/Application/CliApplication\.php
+ libraries/src/Application/ConsoleApplication\.php
+ libraries/src/Document/HtmlDocument\.php
+
+
+
+ administrator/components/com_finder/src/Indexer/Result\.php
+
+