Repository navigation
Conversation
This method was only needed for a context that extends the
SignificantFigures context (for example the Units context via
`context::Units::extending('SignificantFigures')`) because the
`contextSignificantFigures.pl` macro calls the methods of its
`context::SignificantFigures::common` package as `$self->STRING`,
`$self->COPY`, etc. When another context extends the SignificantFigures
context, those calls are made with `$self` blessed into the extension
context's classes, and those classes do not inherit from that package.
So those methods were not found, and the `AUTOLOAD` method was used to
find them in the extended class. Instead the `contextSignificantFigures.pl`
macro now calls those methods with their fully qualified names, so that
they are found regardless of the class of `$self`.
The updated `WWSafe.pm` module based on `Safe.pm` version 2.47 (added in
openwebwork#1520) deletes the `AUTOLOAD` method (as well as the `DELETE` method and
any overloads) in its `_clean_stash` call, and so the current `AUTOLOAD`
method no longer works, and problems using the Units context extending
the SignificantFigures context were broken.
Allowing code that runs in the safe compartment to define a `DESTROY` or
`AUTOLOAD` method or to defined custom overloads is a security
vulnerability that cannot be allowed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drgrice1
force-pushed
the
context-extensions-no-autoload
branch
from
October 27, 2026 21:12
980577a to
bc9523c
Compare
This branch has not been deployed
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.
This method was only needed for a context that extends the SignificantFigures context (for example the Units context via
context::Units::extending('SignificantFigures')) because thecontextSignificantFigures.plmacro calls the methods of itscontext::SignificantFigures::commonpackage as$self->STRING,$self->COPY, etc. When another context extends the SignificantFigures context, those calls are made with$selfblessed into the extension context's classes, and those classes do not inherit from that package. So those methods were not found, and theAUTOLOADmethod was used to find them in the extended class. Instead thecontextSignificantFigures.plmacro now calls those methods with their fully qualified names, so that they are found regardless of the class of$self.The updated
WWSafe.pmmodule based onSafe.pmversion 2.47 (added in #1520) deletes theAUTOLOADmethod (as well as theDELETEmethod and any overloads) in its_clean_stashcall, and so the currentAUTOLOADmethod no longer works, and problems using the Units context extending the SignificantFigures context were broken.Allowing code that runs in the safe compartment to define a
DESTROYorAUTOLOADmethod or to defined custom overloads is a security vulnerability that cannot be allowed.