Repository navigation
Fix running exercises in the sandbox - #335
Merged
Merged
Conversation
On a run, the code patcher patched the reference solution, but a run never copies it, so reading it threw and every run failed. run.start now uses patchStudent, which only patches the student's solution. Runs also passed the student's absolute host path to PHP, which doesn't exist inside the sandbox where the working directory is mounted elsewhere. They now pass the file name relative to the working directory, like verify does.
AydinHassan
force-pushed
the
run-skip-missing-reference
branch
from
October 24, 2026 20:02
76f73aa to
30722a0
Compare
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.
Running an exercise has been failing on phpschool.io. Two bugs; verify wasn't affected by either.
1. The code patcher read a reference solution that a run never copies.
CodePatchListener::patchpatches the student's file and the reference solution's copy. Verify copies the reference solution before patching, but a run only executes the student's code, so it never copies it. Onrun.start,file_get_contents()then hit a missing file, andApplicationturned the warning into an exception.→
run.startnow uses a newpatchStudentmethod, which only patches the student's file. Verify keeps usingpatch. The patch loop moved into a privatepatchFiles.2. Run passed the student's absolute host path to
php.In the Docker sandbox, the working directory is mounted at
/solution, so that path doesn't exist inside the container ("Could not open input file"). Verify already passesbasename(...).→
CliRunner::runandCgiRunner::runnow do the same.Tests:
patchStudentpatches only the student file, andCliRunner::runpasses the entry point relative to the working directory. Both tests fail without the fix.Checked end to end in phpschool.io with the Docker sandbox. Run and verify pass for 22 of 24 learnyouphp and php8appreciate exercises. The other two are composer exercises, and my script didn't install their dependencies.