System-Log: Whoops vermeiden bei Logzeile ohne Pipe-Separator#6489
Open
tyrant88 wants to merge 1 commit intoredaxo:5.xfrom
Open
System-Log: Whoops vermeiden bei Logzeile ohne Pipe-Separator#6489tyrant88 wants to merge 1 commit intoredaxo:5.xfrom
tyrant88 wants to merge 1 commit intoredaxo:5.xfrom
Conversation
Wenn eine Zeile in `system.log` keinen ` |`-Trenner enthält, liefert
`rex_log_entry::createFromString()` ein leeres `data`-Array. Beim Aufruf
der System-Log-Page in `redaxo/src/core/pages/system.log.redaxo.php:53`
fliegt dann eine `InvalidArgumentException`, weil `$data[0]` undefined →
`null` ist und `rex_type::string(null)` direkt aussteigt:
> InvalidArgumentException: Exptected a string, but got null
> redaxo/src/core/lib/util/type.php:218
Folge: die System-Log-Page selbst lässt sich nicht mehr öffnen, was die
Diagnose erschwert (genau die Page, die man jetzt bräuchte, ist tot).
Aufgetreten auf einer produktiven REDAXO-5.21-Installation; im Log
steht erst die Warning ("Undefined array key 0", `system.log.redaxo.php:53`),
beim nächsten Aufruf dann die Fatal Exception.
Fix: Null-Coalesce auf '' für `$data[0]` und `$data[1]`, damit auch
malformierte Logzeilen sauber gerendert werden (mit leerem Type/Message).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wenn eine Zeile im system.log kein Pipe "|"-Trenner enthält, liefert rex_log_entry::createFromString() ein leeres "data"-Array.
Beim Aufruf der System-Log-Page wird dann eine Exception geworfen, weil $data[0] undefined also "null" ist.
Fix: Null-Coalesce auf '' für "$data[0]" und "$data[1]".
Ich konnte zwar nicht mehr ermitteln, wie das passierte, denke aber sinnvoll ist es anyway.