tikguy
Forum Replies Created
-
if there’s an error, the array structure (properly populated with values) will be there as before, because the changed behaviour of php8.2 only affects the situation if there’s no error. the piece of code i added only affects the situation where there’s a boolean value as the argument of the function. if anything else comes (which by default couldn’t be anything else than an array structure) it will be passed along w/o any kind of modification
yes. i essentially did nothing more, but
– removed the type enforcement
– added an if to check whether the received argument is a boolean (in pre8.2 php this can not happen, with 8.2+ it will only get false if there was no error)
– in this case (got false) i populate the array just as pre 8.2 php did
this fix got my queued messages delivered, as the code ran w/o hitting the old exceptionthis should fix it.
--- Carbon.php.orig 2023-04-23 22:10:28.395805000 +0200 +++ Carbon.php 2023-04-23 22:07:28.731780000 +0200 @@ -797,8 +797,16 @@ * * @return void */ - private static function setLastErrors(array $lastErrors) + private static function setLastErrors($lastErrors) { + if (is_bool($lastErrors)) { + $lastErrors=array( + "warning_count" => 0, + "warnings" => Array(), + "error_count" => 0, + "errors" => Array() + ); + } static::$lastErrors = $lastErrors; } /**