Some php 8.4 deprecation fixes
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 27s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m29s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 4m35s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2025-02-16 14:09:30 +11:00
parent 7e0d1eb0e3
commit 7950cc3404
12 changed files with 12 additions and 12 deletions

View File

@ -52,7 +52,7 @@ abstract class Base
return $source === $this->encode($compare); return $source === $this->encode($compare);
} }
protected function salted_hash(string $password,string $algo,int $salt_size=8,string $salt=NULL): string protected function salted_hash(string $password,string $algo,int $salt_size=8,?string $salt=NULL): string
{ {
if (is_null($salt)) if (is_null($salt))
$salt = hex2bin(random_salt($salt_size)); $salt = hex2bin(random_salt($salt_size));

View File

@ -20,7 +20,7 @@ final class Blowfish extends Base
return hash_equals($cp=self::password($source),crypt($compare,$cp)); return hash_equals($cp=self::password($source),crypt($compare,$cp));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
if (is_null($salt)) if (is_null($salt))
$salt = sprintf('%s%d$%s',self::identifier,self::cost,random_salt(self::salt)); $salt = sprintf('%s%d$%s',self::identifier,self::cost,random_salt(self::salt));

View File

@ -19,7 +19,7 @@ final class Crypt extends Base
return hash_equals($cp=self::password($source),crypt($compare,$cp)); return hash_equals($cp=self::password($source),crypt($compare,$cp));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
if (is_null($salt)) if (is_null($salt))
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt)); $salt = sprintf('%s%s',self::identifier,random_salt(self::salt));

View File

@ -19,7 +19,7 @@ final class ExtDes extends Base
return hash_equals($cp=self::password($source),crypt($compare,$cp)); return hash_equals($cp=self::password($source),crypt($compare,$cp));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
if (is_null($salt)) if (is_null($salt))
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt)); $salt = sprintf('%s%s',self::identifier,random_salt(self::salt));

View File

@ -19,7 +19,7 @@ final class MD5crypt extends Base
return hash_equals($cp=self::password($source),crypt($compare,$cp)); return hash_equals($cp=self::password($source),crypt($compare,$cp));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
if (is_null($salt)) if (is_null($salt))
$salt = sprintf('%s$%s',self::identifier,random_salt(self::salt)); $salt = sprintf('%s$%s',self::identifier,random_salt(self::salt));

View File

@ -19,7 +19,7 @@ final class SHA256crypt extends Base
return hash_equals($cp=self::password($source),crypt($compare,$cp)); return hash_equals($cp=self::password($source),crypt($compare,$cp));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
if (is_null($salt)) if (is_null($salt))
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt)); $salt = sprintf('%s%s',self::identifier,random_salt(self::salt));

View File

@ -19,7 +19,7 @@ final class SHA512crypt extends Base
return hash_equals($cp=self::password($source),crypt($compare,$cp)); return hash_equals($cp=self::password($source),crypt($compare,$cp));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
if (is_null($salt)) if (is_null($salt))
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt)); $salt = sprintf('%s%s',self::identifier,random_salt(self::salt));

View File

@ -12,7 +12,7 @@ final class SSHA256 extends Base
return $source === $this->encode($compare,$this->salted_salt($source)); return $source === $this->encode($compare,$this->salted_salt($source));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha256',self::salt,$salt)); return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha256',self::salt,$salt));
} }

View File

@ -12,7 +12,7 @@ final class SSHA384 extends Base
return $source === $this->encode($compare,$this->salted_salt($source)); return $source === $this->encode($compare,$this->salted_salt($source));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha384',self::salt,$salt)); return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha384',self::salt,$salt));
} }

View File

@ -12,7 +12,7 @@ final class SSHA512 extends Base
return $source === $this->encode($compare,$this->salted_salt($source)); return $source === $this->encode($compare,$this->salted_salt($source));
} }
public function encode(string $password,string $salt=NULL): string public function encode(string $password,?string $salt=NULL): string
{ {
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha512',self::salt,$salt)); return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha512',self::salt,$salt));
} }

View File

@ -17,7 +17,7 @@ class Attribute extends Component
/** /**
* Create a new component instance. * Create a new component instance.
*/ */
public function __construct(?LDAPAttribute $o,bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $na=NULL) public function __construct(?LDAPAttribute $o,bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,?string $na=NULL)
{ {
$this->o = $o; $this->o = $o;
$this->edit = $edit; $this->edit = $edit;

View File

@ -18,7 +18,7 @@ class AttributeType extends Component
/** /**
* Create a new component instance. * Create a new component instance.
*/ */
public function __construct(LDAPAttribute $o,bool $new=FALSE,Collection $oc=NULL) public function __construct(LDAPAttribute $o,bool $new=FALSE,?Collection $oc=NULL)
{ {
$this->o = $o; $this->o = $o;
$this->oc = $oc; $this->oc = $oc;