[3.0] Answer a personal message link that points at nothing - #9464
Open
albertlast wants to merge 1 commit into
Open
[3.0] Answer a personal message link that points at nothing#9464albertlast wants to merge 1 commit into
albertlast wants to merge 1 commit into
Conversation
Folder::show() assigned whatever PM::load() found straight to
$requested_pm, which is a typed object property:
$this->requested_pm = current(PM::load((int) $_GET[$var]));
PM::load() finds nothing for an ID that was pruned or was never real, and
current() answers false for that, so the page ends with "Cannot assign
false to property SMF\PersonalMessage\Folder::$requested_pm of type
object" - a 500 for a stale bookmark or a link in an old notification.
Behind that sits a second one. A pmid of 0, a negative number or anything
non-numeric casts to 0, and PM::load() takes that as far as the database
before failing with "given array of integer values is empty", which is
another 500 for a URL a member only has to mistype.
Both now get the answer the check below them already gives a PM that
belongs to somebody else: you are not allowed to access this section.
Signed-off-by: Mathias Albert <mathiaspapealbert@hotmail.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
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.
Description
Folder::show()assigns whateverPM::load()found straight to$requested_pm, which is a typed object property:PM::load()finds nothing for an ID that has been pruned or was never real, andcurrent()answersfalsefor that. So the request ends before the access check runs:A 500, for a stale bookmark or a link in an old notification — and PM pruning is a feature, so the IDs in those links do go away.
Behind that sits a second one. A
pmidof0, a negative number, or anything non-numeric all cast to0, andPM::load()carries that as far as the database before failing:Another 500, for a URL a member only has to mistype. Fixing just the first leaves this one, so both are here.
Both now get the answer the check below them already gives for a PM belonging to somebody else.
pmid=999pmsg=999pmid=0pmid=abcpmid=-5pmid=1(a real one)The inbox, the sent folder, a real
pmidand a quote form all still render, with nothing added tosmf_log_errors.Issues References (Fixes|Related|Closes)
n/a