diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-09-19 23:12:48 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-09-20 09:25:02 -0700 |
commit | a623f8939cbcaa58a069807591675c0ebcd4135b (patch) | |
tree | 6e4f3122df0aefeac3b4eb007f9b869a850c6df9 /scope.c | |
parent | fd01b4b766a3276a9439cade9b1a047c37876c1b (diff) | |
download | perl-a623f8939cbcaa58a069807591675c0ebcd4135b.tar.gz |
Implement the bipolar read-only system
This fixes bugs related to Hash::Util::unlock accidentally unlocking
internal scalars (e.g., that returned by undef()) and allowing them to
be modified.
Internal read-only values are now marked by two flags, the regular
read-only flag, and the new ‘protected’ flag.
Before this SvREADONLY served two purposes:
1) The code would use it to protect things that must not be modi-
fied, ever (except when the core sees fit to do so).
2) Hash::Util and everybody else would use it to make this unmodifia-
ble temporarily when requested by the user.
Internals::SvREADONLY serves the latter purpose and only flips the
read-only flag, so things that need to stay read-only will remain so,
because of the ‘other’ read-only flag, that CPAN doesn’t know about.
(If you are a CPAN author, do not read this.)
Diffstat (limited to 'scope.c')
-rw-r--r-- | scope.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -986,7 +986,7 @@ Perl_leave_scope(pTHX_ I32 base) /* these flags are the union of all the relevant flags * in the individual conditions within */ if (UNLIKELY(SvFLAGS(sv) & ( - SVf_READONLY /* for SvREADONLY_off() */ + SVf_READONLY|SVf_PROTECT /*for SvREADONLY_off*/ | (SVs_GMG|SVs_SMG|SVs_RMG) /* SvMAGICAL() */ | SVf_OOK | SVf_THINKFIRST))) |