diff --git a/contrib/smarty/plugins/block.render.php b/contrib/smarty/plugins/block.render.php index 23e6b8a72652fae47919f4732cf21282329eb9b5..3d93c29d0049c016d065faf9a171226fcf7a5ee6 100755 --- a/contrib/smarty/plugins/block.render.php +++ b/contrib/smarty/plugins/block.render.php @@ -44,8 +44,8 @@ function smarty_block_render ($params, $text) /* Disable objects, but keep those active that have mode=read_active */ if (!(isset($params['mode']) && ($params['mode'] == 'read_active') && preg_match('/(r|w)/', $acl)) - && !preg_match('/ disabled(="disabled")?( |\/?>)/', $text)) { - $text = preg_replace('/name=/i', 'disabled="disabled" name=', $text); + && !preg_match('/ disabled(="disabled")?( |\/?>)/', (string) $text)) { + $text = preg_replace('/name=/i', 'disabled="disabled" name=', (string) $text); } /* Read only */ @@ -54,10 +54,10 @@ function smarty_block_render ($params, $text) } /* No acls */ - if (preg_match('/type[\'"= ].*submit/s', $text)) { - $text = preg_replace('/submit/', 'button', $text); + if (preg_match('/type[\'"= ].*submit/s', (string) $text)) { + $text = preg_replace('/submit/', 'button', (string) $text); } else { - $text = preg_replace('/value=[\'"][^"\']*[\'"]/', '', $text); + $text = preg_replace('/value=[\'"][^"\']*[\'"]/', '', (string) $text); } /* Remove select options */ diff --git a/contrib/smarty/plugins/function.msgPool.php b/contrib/smarty/plugins/function.msgPool.php index 3566d8bea47ea4cbae48eb3dfed600fdfb75292c..8c3d7341b7413c5331546c54eadaf5c55b0f7176 100755 --- a/contrib/smarty/plugins/function.msgPool.php +++ b/contrib/smarty/plugins/function.msgPool.php @@ -18,12 +18,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -function smarty_function_msgPool ($params) +function smarty_function_msgPool ($params): void { if (class_available('msgPool') && isset($params['type'])) { $parameter = []; foreach ($params as $para => $value) { - if (!preg_match('/^type$/i', $para)) { + if (!preg_match('/^type$/i', (string) $para)) { $parameter[$para] = $value; } } diff --git a/html/autocomplete.php b/html/autocomplete.php index 0f902f0aa47f136dac50bd2d9947ae6bcc698f75..d5da39a6f1c17740ce013c0ebfaef4c6e79c0840 100755 --- a/html/autocomplete.php +++ b/html/autocomplete.php @@ -50,15 +50,15 @@ if (isset($_GET['type']) && $_GET['type'] == "base") { if (!isset($pathMapping[$dn])) { continue; } - if (mb_stristr((string) $info['name'], $search) !== FALSE) { + if (mb_stristr((string) $info['name'], (string) $search) !== FALSE) { $res .= "<li>".mark($search, $pathMapping[$dn]).($info['description'] == '' ? "" : "<span class='informal'> [".mark($search, $info['description'])."]</span>")."</li>"; continue; } - if (mb_stristr((string) $info['description'], $search) !== FALSE) { + if (mb_stristr((string) $info['description'], (string) $search) !== FALSE) { $res .= "<li>".mark($search, $pathMapping[$dn]).($info['description'] == '' ? "" : "<span class='informal'> [".mark($search, $info['description'])."]</span>")."</li>"; continue; } - if (mb_stristr($pathMapping[$dn], $search) !== FALSE) { + if (mb_stristr($pathMapping[$dn], (string) $search) !== FALSE) { $res .= "<li>".mark($search, $pathMapping[$dn]).($info['description'] == '' ? "" : "<span class='informal'> [".mark($search, $info['description'])."]</span>")."</li>"; continue; } diff --git a/include/class_config.inc b/include/class_config.inc index 2ec72a7be8e1c50b5c05ed252b3e22f88513a3b2..f60571fb77fc176f62e2fa270b0a8d01cc0fcbfa 100755 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -489,7 +489,7 @@ class config } else { $value = $attrs[$key][0]; } - $key = strtoupper(preg_replace('/^fd/', '', (string) $key)); + $key = strtoupper((string) preg_replace('/^fd/', '', (string) $key)); $this->current[$key] = $value; } } @@ -734,7 +734,7 @@ class config foreach ($this->departmentList as $val) { /* Split dn into single department pieces */ - $elements = array_reverse(explode(',', preg_replace("/$qbase$/", '', (string) $val))); + $elements = array_reverse(explode(',', (string) preg_replace("/$qbase$/", '', (string) $val))); /* Add last ou element of current dn to our array */ $last = &$arr; diff --git a/include/class_ldap.inc b/include/class_ldap.inc index aa55fed119674ff2cf3d3b49be18766a47176159..6628f0b5e5792120fd7af076c13559854a904c0f 100755 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -932,7 +932,7 @@ class LDAP if (!$this->dn_exists($cdn)) { $type = preg_replace('/^([^=]+)=.*$/', '\\1', (string) $cdn); $param = preg_replace('/^[^=]+=([^,]+).*$/', '\\1', (string) $cdn); - $param = preg_replace(['/\\\\,/','/\\\\"/'], [',','"'], $param); + $param = preg_replace(['/\\\\,/','/\\\\"/'], [',','"'], (string) $param); $na = []; @@ -1095,7 +1095,7 @@ class LDAP { $ret = []; $url = preg_replace('!\?\?.*$!', '', (string) $url); - $server = preg_replace('!^([^:]+://[^/]+)/.*$!', '\\1', $url); + $server = preg_replace('!^([^:]+://[^/]+)/.*$!', '\\1', (string) $url); if ($referrals === NULL) { $referrals = $this->referrals; @@ -1487,13 +1487,13 @@ class LDAP /* Remove ' and " if needed */ $value = preg_replace('/^[\'"]/', '', (string) $value); - $value = preg_replace('/[\'"] *$/', '', $value); + $value = preg_replace('/[\'"] *$/', '', (string) $value); /* Convert to array if $ is inside... */ - if (preg_match('/\$/', $value)) { - $container = preg_split('/\s*\$\s*/', $value); + if (preg_match('/\$/', (string) $value)) { + $container = preg_split('/\s*\$\s*/', (string) $value); } else { - $container = rtrim($value); + $container = rtrim((string) $value); } return $container; diff --git a/include/class_ldapFilter.inc b/include/class_ldapFilter.inc index 2bdfedc56647d53d6e35331f4fecf9f52c6c9e75..d5805ce2fe5adf7dc6b7d984308ab4d9e0ae0b45 100755 --- a/include/class_ldapFilter.inc +++ b/include/class_ldapFilter.inc @@ -121,7 +121,7 @@ class ldapFilter implements \Stringable } else { return new ldapFilter($filter[0], $subfilters); } - } elseif (preg_match('/^([^\\(\\)\\=\\>\\<]+)('.implode('|', ldapFilterLeaf::$operators).')([^\\(\\)]*)$/', $filter, $m)) { + } elseif (preg_match('/^([^\\(\\)\\=\\>\\<]+)('.implode('|', ldapFilterLeaf::$operators).')([^\\(\\)]*)$/', (string) $filter, $m)) { return new ldapFilterLeaf($m[1], $m[2], $m[3]); } else { throw new FusionDirectoryException('Failed to parse '.$filter); @@ -157,11 +157,11 @@ class ldapFilterLeaf extends ldapFilter implements \Stringable } $search = preg_replace(['/^\\*/','/\\*$/'], '', (string) $this->subparts[1]); if ($this->dnFilter) { - $this->pattern = '/'.$left.'='.$prefix.preg_quote($search, '/').$suffix.',/'; + $this->pattern = '/'.$left.'='.$prefix.preg_quote((string) $search, '/').$suffix.',/'; } elseif ($this->subparts[1] == '*') { $this->pattern = '/^.*$/'; } else { - $this->pattern = '/^'.$prefix.preg_quote($search, '/').$suffix.'$/'; + $this->pattern = '/^'.$prefix.preg_quote((string) $search, '/').$suffix.'$/'; } } } diff --git a/include/class_tests.inc b/include/class_tests.inc index 62f471e5e35e1a5ed81d7cce1766c4db996132db..b6b2e3cd4627ad89b22563d973dceb5a369754ce 100755 --- a/include/class_tests.inc +++ b/include/class_tests.inc @@ -206,8 +206,8 @@ class tests "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.". "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/", "", (string) $ip); - $mask = preg_replace("/^\//", "", $mask); - if ((in_array("$mask", $res)) && preg_match("/^[0-9\.]/", $mask)) { + $mask = preg_replace("/^\//", "", (string) $mask); + if ((in_array("$mask", $res)) && preg_match("/^[0-9\.]/", (string) $mask)) { return TRUE; } } diff --git a/include/functions.inc b/include/functions.inc index bbae1843a5f0a86234f2358d3c756c4b5425cbcb..feb4f59e0db90073c8be19cf2850fe021b2c23ff 100755 --- a/include/functions.inc +++ b/include/functions.inc @@ -1479,7 +1479,7 @@ function isIpInNet ($ip, $net, $mask) function expandIPv6 ($ip) { $hex = unpack('H*hex', inet_pton($ip)); - return substr(preg_replace('/([A-f0-9]{4})/', "$1:", (string) $hex['hex']), 0, -1); + return substr((string) preg_replace('/([A-f0-9]{4})/', "$1:", (string) $hex['hex']), 0, -1); } /* Mark the occurance of a string with a span */ diff --git a/include/management/class_ListingEntry.inc b/include/management/class_ListingEntry.inc index 9dee22006ed23507861740deb52544d4ee19a67d..4447ff30d3888e6293f5ad61b4467edabc118c21 100755 --- a/include/management/class_ListingEntry.inc +++ b/include/management/class_ListingEntry.inc @@ -84,12 +84,12 @@ class ListingEntry implements ArrayAccess public function isTemplate (): bool { - return preg_match('/^template_/', $this->type); + return preg_match('/^template_/', (string) $this->type); } public function getTemplatedType (): string { - return preg_replace('/^template_/', '', $this->type); + return preg_replace('/^template_/', '', (string) $this->type); } public function getTemplatedFields (): array @@ -104,7 +104,7 @@ class ListingEntry implements ArrayAccess $infos = objects::infos($this->getTemplatedType()); $rights = $ui->get_permissions($this->aclBase, $infos['aclCategory'].'/'.($this->isTemplate() ? 'template' : $infos['mainTab'])); foreach (str_split($acls) as $acl) { - if (strpos($rights, $acl) === FALSE) { + if (!str_contains((string) $rights, $acl)) { return FALSE; } } diff --git a/plugins/management/groups/tabs_ogroups.inc b/plugins/management/groups/tabs_ogroups.inc index e9842eee50f7667fdf83ce8fc254b99a86418b53..fb75905f8a94441a193dacbe18bf8073ff474f33 100755 --- a/plugins/management/groups/tabs_ogroups.inc +++ b/plugins/management/groups/tabs_ogroups.inc @@ -46,14 +46,14 @@ class ogrouptabs extends simpleTabs_noSpecial $objects = preg_replace('/[\[\]]/', '', (string) $gosaGroupObjects); $tabs = []; - if (strlen($objects)) { + if (strlen((string) $objects)) { if (isset($config->data['TABS']['OGROUP-DYNAMICTABS'])) { $dtabs = $config->data['TABS']['OGROUP-DYNAMICTABS']; } else { $dtabs = []; } $tabs = FALSE; - for ($i = 0; $i < strlen($objects); $i++) { + for ($i = 0; $i < strlen((string) $objects); $i++) { if (in_array($objects[$i], ['I','G'])) { /* Ignore unknown objects and groups */ continue; diff --git a/plugins/management/tasks/class_tasksColumn.inc b/plugins/management/tasks/class_tasksColumn.inc index 5d5ca9605678c8d62035aed43cc8f8d52549c536..026f0c3f8da932945603e6e30a40c728c774afcd 100755 --- a/plugins/management/tasks/class_tasksColumn.inc +++ b/plugins/management/tasks/class_tasksColumn.inc @@ -65,7 +65,7 @@ class TasksColumn extends Column // remove 'dn' keeping only 'cn' $rmDn = preg_replace('/(?=,).*/', '', (string) $value); // only take the cn without dc - preg_match('/cn=(.*)/', $rmDn, $matches); + preg_match('/cn=(.*)/', (string) $rmDn, $matches); return $matches[1]; } diff --git a/plugins/workflow/tasks/class_tasksMail.inc b/plugins/workflow/tasks/class_tasksMail.inc index 86c4e90b72b75a3dead67932fe6842f37a5e0e1d..ff9d9c3e195a22fb3428eb68d7b9b5aeff72b811 100755 --- a/plugins/workflow/tasks/class_tasksMail.inc +++ b/plugins/workflow/tasks/class_tasksMail.inc @@ -183,7 +183,7 @@ class tasksMail extends simplePlugin // Remove anything between curly braces (e.g., {PERSO}, {PRO} as well as supann labels) $cleanMail = preg_replace('/.+?(?=supann)/', '', (string) $info[$mailAttr][0]); - $finalMail = preg_replace('/\{.*?\}/', '', $cleanMail); + $finalMail = preg_replace('/\{.*?\}/', '', (string) $cleanMail); $mailList[] = $finalMail;