Skip to content

Commit 6419623

Browse files
Fix bad error checking in build error handling logic (#3358)
The legacy BuildError and BuildFailure models are treated as if they're derived from the same parent class in the build handler, but there's no guarantee that the fields the build handler attempts to access actually exist on a particular object. This PR resolves a critical issue introduced by #3320 which causes failures when parsing builds with old style build errors.
1 parent de30fed commit 6419623

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

app/Http/Submission/Handlers/BuildHandler.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,7 @@ public function endElement($parser, $name): void
451451
if ($threshold > 0) {
452452
$chunk_size = $threshold / 2;
453453
foreach (['StdOutput', 'StdError'] as $field) {
454-
if (!($this->Error instanceof BuildFailure)) {
455-
throw new RuntimeException('Field "Error" is not instance of BuildFailure.');
456-
}
457-
if (isset($this->Error->$field)) {
454+
if ($this->Error instanceof BuildFailure && isset($this->Error->$field)) {
458455
$outlen = strlen($this->Error->$field);
459456
if ($outlen > $threshold) {
460457
// First try removing suppressed warnings to see

0 commit comments

Comments
 (0)