Branch: refs/heads/yves/restricted_hash_disallow_alias_or_local
Home: https://github.com/Perl/perl5
Commit: b571f323d1720029a816732ac03b399f075e4452
https://github.com/Perl/perl5/commit/b571f323d1720029a816732ac03b399f075e4452
Author: Yves Orton <[email protected]>
Date: 2023-03-25 (Sat, 25 Mar 2023)
Changed paths:
M embed.fnc
M hv.c
M hv.h
M pod/perldiag.pod
M pp.c
M pp_hot.c
M proto.h
M t/op/lvref.t
Log Message:
-----------
pp.c - forbid localizing and aliasing readonly hash keys in restricted hashes
local $hash{key} and \$hash{key} = \$var are both conceptually modify
operations which are forbidden when the hash is restricted and the value
is readonly. Unfortunately prior to this commit they were still allowed
operations. This patch corrects that oversight.
Adds a bunch of tests to t/op/lvref.t to ensure that it is illegal to
localize or ref-alias a readonly value in a restricted hash.