fix PHP8 deprecation warnings: "Required parameter X follows optional parameter Y"

Deprecated: Required parameter $username follows optional parameter $attributes in inc/drivers_ldap.php on line 190
Deprecated: Required parameter $passwd follows optional parameter $attributes in inc/drivers_ldap.php on line 190
Deprecated: Required parameter $ua_string follows optional parameter $min_age in inc/external-fetch.php on line 42

As explained in https://www.php.net/manual/en/migration80.deprecated.php,
    If a parameter with a default value is followed by a required
    parameter, the default value has no effect. This is deprecated as of
    PHP 8.0.0 and can generally be resolved by dropping the default
    value, without a change in functionality
This commit is contained in:
Florian Schlichting 2021-02-03 23:22:58 +08:00
parent 6cdbfcf226
commit 75f62a81f6
2 changed files with 5 additions and 3 deletions

View File

@ -180,14 +180,16 @@ class ldapDriver
}
/**
* Returns the result of the LDAP query
* Actually look up a user in the LDAP directory
* (this is the LDAP part of LDAP_check() below)
*
* @param string $filter The filter used to search entries
* @param array $attributes Attributes to be returned
* @param string $username username to check
* @param string $passwd password to check
* @return array Contains selected attributes from all entries corresponding to the given filter
*/
function requestUser( $filter, $attributes=NULL, $username, $passwd) {
function requestUser( $filter, $attributes, $username, $passwd) {
global $c;
$entry=NULL;

View File

@ -39,7 +39,7 @@ function create_external ( $path,$is_calendar,$is_addressbook )
}
}
function fetch_external ( $bind_id, $min_age = '1 hour', $ua_string )
function fetch_external ( $bind_id, $min_age, $ua_string )
{
if ( ! function_exists ( "curl_init" ) ) {
dbg_error_log("external", "external resource cannot be fetched without curl, please install curl");