Revert added exception in the sandbox#3893
Merged
Conversation
dgw
approved these changes
Apr 6, 2025
Member
dgw
left a comment
There was a problem hiding this comment.
Just fine on its face; #3871 changed yourls_include_file_sandbox()'s behavior when it probably didn't need to.
Deeper musings unrelated to making a hotfix
Hmm, from this comment in the function doc:
* This function does not check first if the file exists : depending on use case, you may check first.
I would think that upstream code is expected to test for the file's existence before trying to include_file_sandbox it, here in between setting $uninst_file and $attempt:
YOURLS/includes/functions-plugins.php
Lines 691 to 703 in b3848d4
Something like this, maybe (GH doesn't support creating suggestions outside the patched area of a PR, sadly)?
// Check if we have an uninstall file - load if so
$uninst_file = YOURLS_PLUGINDIR . '/' . dirname($plugin) . '/uninstall.php';
$attempt = yourls_include_file_sandbox( $uninst_file );
// Try to set plugin uninstall mode if valid
if ( file_exists( $uninst_file ) {
if ( $attempt === true ) {
define('YOURLS_UNINSTALL_PLUGIN', true);
}
}
// Check if we have an error to display
elseif ( is_string( $attempt ) ) {
$message = yourls_s( 'Loading %s generated unexpected output. Error was: <br/><pre>%s</pre>', $uninst_file, $attempt );
return( $message );
}
tomtenuta
pushed a commit
to tomtenuta/YOURLS
that referenced
this pull request
Nov 4, 2025
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.
Fixes #3892
Ref #3871