MDL-73700 lib: remove old PHP version check

As MDL-73016 set the minimum supported PHP version for Moodle 4.4 and up
to PHP 8.1 we can now safely remove this check.

As it was decided that we will not upgrade this library from upstream
any more (see MDL-52465) we can probably safely remove this. This change
is one of a long series of earlier changes. See readme_moodle.txt.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
This commit is contained in:
Daniel Ziegenberg 2024-03-20 12:30:01 +01:00
parent 224a7d2aac
commit da3b7722ae
No known key found for this signature in database
GPG Key ID: 7E6F98FFADBEFD39
3 changed files with 3 additions and 56 deletions

View File

@ -32,9 +32,6 @@ define('PEAR_ERROR_CALLBACK', 16);
* @deprecated
*/
define('PEAR_ERROR_EXCEPTION', 32);
/**#@-*/
define('PEAR_ZE2', (function_exists('version_compare') &&
version_compare(zend_version(), "2-dev", "ge")));
if (substr(PHP_OS, 0, 3) == 'WIN') {
define('OS_WINDOWS', true);
@ -533,12 +530,6 @@ class PEAR
$ec = 'PEAR_Error';
}
if (intval(PHP_VERSION) < 5) {
// little non-eval hack to fix bug #12147
include 'PEAR/FixPHP5PEARWarnings.php';
return $a;
}
if ($skipmsg) {
$a = new $ec($code, $mode, $options, $userinfo);
} else {
@ -738,10 +729,6 @@ class PEAR
}
}
if (PEAR_ZE2) {
include_once 'PEAR5.php';
}
function _PEAR_call_destructors()
{
global $_PEAR_destructor_object_list;
@ -749,11 +736,7 @@ function _PEAR_call_destructors()
sizeof($_PEAR_destructor_object_list))
{
reset($_PEAR_destructor_object_list);
if (PEAR_ZE2) {
$destructLifoExists = PEAR5::getStaticProperty('PEAR', 'destructlifo');
} else {
$destructLifoExists = PEAR::getStaticProperty('PEAR', 'destructlifo');
}
$destructLifoExists = PEAR::getStaticProperty('PEAR', 'destructlifo');
if ($destructLifoExists) {
$_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
@ -849,11 +832,7 @@ class PEAR_Error
$this->mode = $mode;
$this->userinfo = $userinfo;
if (PEAR_ZE2) {
$skiptrace = PEAR5::getStaticProperty('PEAR_Error', 'skiptrace');
} else {
$skiptrace = PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
}
$skiptrace = PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
if (!$skiptrace) {
$this->backtrace = debug_backtrace();

View File

@ -1,33 +0,0 @@
<?php
/**
* This is only meant for PHP 5 to get rid of certain strict warning
* that doesn't get hidden since it's in the shutdown function
*/
class PEAR5
{
/**
* If you have a class that's mostly/entirely static, and you need static
* properties, you can use this method to simulate them. Eg. in your method(s)
* do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
* You MUST use a reference, or they will not persist!
*
* @access public
* @param string $class The calling classname, to prevent clashes
* @param string $var The variable to retrieve.
* @return mixed A reference to the variable. If not set it will be
* auto initialised to NULL.
*/
static function &getStaticProperty($class, $var)
{
static $properties;
if (!isset($properties[$class])) {
$properties[$class] = array();
}
if (!array_key_exists($var, $properties[$class])) {
$properties[$class][$var] = null;
}
return $properties[$class][$var];
}
}

View File

@ -41,6 +41,7 @@ MDL-78145 - PHP 8.2 compliance. Added a missing class property that still need t
MDL-78527 - Adding a sixth parameter to allow groups to use attributes.
MDL-80818 - Freezing all elements with the same name (e.g. radio buttons)
MDL-80820 - PHPdocs corrections
MDL-73700 - remove old PHP version check and dead code
Pear
====