Skip to content

Commit

Permalink
Ensure LastError exception only passes integers
Browse files Browse the repository at this point in the history
As of PHP 8.1, null can no longer be passed to the second constructor
argument of builtin exceptions. It will raise an error, resulting in log spam.

Found executing the test suite of horde/yaml in php 8.1
  • Loading branch information
ralflang committed Aug 19, 2022
1 parent 754c7a3 commit 15b6109
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Horde/Exception/LastError.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct($message = null, $code_or_lasterror = null)
$this->file = $code_or_lasterror['file'];
$this->line = $code_or_lasterror['line'];
} else {
parent::__construct($message, $code_or_lasterror);
parent::__construct($message, $code_or_lasterror ?? 0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Horde/Exception/PermissionDenied.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Horde_Exception_PermissionDenied extends Horde_Exception
*
* @see Horde_Exception::__construct()
*
* @param mixed $message The exception message, a PEAR_Error
* @param string|Exception $message The exception message, a PEAR_Error
* object, or an Exception object.
* @param integer $code A numeric error code.
*/
Expand Down

0 comments on commit 15b6109

Please sign in to comment.