1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Fix error handler on PHP 8

Summary:
PHP 7.2.0 deprecated the 5th parameter and PHP 8 removed it, so stop
using it and provide a default value to avoid erroring with:

```
Too few arguments to function PhutilErrorHandler::handleError(), 4 passed and exactly 5 expected
```

Test Plan: Used to create this revision with PHP 8 on macOS

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21498
This commit is contained in:
Jessica Clarke 2021-01-11 02:02:16 +00:00 committed by jrtc27
parent 930f7e117d
commit 446dcf1ccd
2 changed files with 3 additions and 5 deletions

View file

@ -180,10 +180,10 @@ final class PhutilErrorHandler extends Phobject {
* @return void
* @task internal
*/
public static function handleError($num, $str, $file, $line, $ctx) {
public static function handleError($num, $str, $file, $line, $ctx = null) {
foreach (self::$traps as $trap) {
$trap->addError($num, $str, $file, $line, $ctx);
$trap->addError($num, $str, $file, $line);
}
if ((error_reporting() & $num) == 0) {
@ -214,7 +214,6 @@ final class PhutilErrorHandler extends Phobject {
array(
'file' => $file,
'line' => $line,
'context' => $ctx,
'error_code' => $num,
'trace' => $trace,
));

View file

@ -41,13 +41,12 @@ final class PhutilErrorTrap extends Phobject {
private $destroyed;
private $errors = array();
public function addError($num, $str, $file, $line, $ctx) {
public function addError($num, $str, $file, $line) {
$this->errors[] = array(
'num' => $num,
'str' => $str,
'file' => $file,
'line' => $line,
'ctx' => $ctx,
);
return $this;
}