MDL-76102 lib: PEAR - passing null to str functions is deprecated

This commit is contained in:
Marina Glancy 2022-10-27 07:36:26 +02:00
parent 35f39c45b7
commit 4b99c6a795
5 changed files with 7 additions and 5 deletions

View File

@ -168,7 +168,7 @@ class HTML_Common {
if (is_array($attributes)) {
foreach ($attributes as $key => $value) {
$strAttr .= ' ' . $key . '="' . htmlspecialchars($value) . '"';
$strAttr .= ' ' . $key . '="' . htmlspecialchars($value ?? '') . '"';
}
}
return $strAttr;

View File

@ -733,7 +733,7 @@ class HTML_QuickForm extends HTML_Common {
{
static $anonGroups = 1;
if (0 == strlen($name)) {
if (0 == strlen($name ?? '')) {
$name = 'qf_group_' . $anonGroups++;
$appendName = false;
}
@ -813,6 +813,7 @@ class HTML_QuickForm extends HTML_Common {
function getSubmitValue($elementName)
{
$value = null;
$elementName = $elementName ?? '';
if (isset($this->_submitValues[$elementName]) || isset($this->_submitFiles[$elementName])) {
$value = isset($this->_submitValues[$elementName])? $this->_submitValues[$elementName]: array();
if (is_array($value) && isset($this->_submitFiles[$elementName])) {

View File

@ -76,7 +76,7 @@ class HTML_QuickForm_RuleRegistry
*/
function registerRule($ruleName, $type, $data1, $data2 = null)
{
$type = strtolower($type);
$type = strtolower($type ?? '');
if ($type == 'regex') {
// Regular expression
$rule =& $this->getRule('regex');

View File

@ -351,7 +351,7 @@ class HTML_QuickForm_element extends HTML_Common
if (empty($values)) {
return null;
}
$elementName = $this->getName();
$elementName = $this->getName() ?? '';
if (isset($values[$elementName])) {
return $values[$elementName];
} elseif (strpos($elementName, '[')) {
@ -447,7 +447,7 @@ class HTML_QuickForm_element extends HTML_Common
return;
}
$id = $this->getName();
$id = $this->getName() ?? '';
$id = 'id_' . str_replace(array('qf_', '[', ']'), array('', '_', ''), $id);
$id = clean_param($id, PARAM_ALPHANUMEXT);
$this->updateAttributes(array('id' => $id));

View File

@ -32,6 +32,7 @@ MDL-70457 - PHP 7.4 curly brackets string access fix.
MDL-71126 - Quiz: Manual grading page size preference can get stuck at 0
Including in this change:
- New positiveint regex rule to check if the value is a positive integer
MDL-76102 - PHP 8.1 passing null to a non-nullable argument of a built-in function is deprecated
Pear
====