Under argless eval (i.e. defaults to $_) in the presence of hints,
the perl core was recursively calling ck_eval, which had the side-effect
of attempting to append an OP_HINTSEVAL op twice. Formerly due to the way
the appending was done, the first OP_HINTSEVAL op was silently discarded;
after doing things "properly" with op_sibling_splice(), both ops ended up
being appended, and at run-time, the hints hash would be interpreted as
the SV to eval.
This wasn't tested in the core tests, and just ended up sometimes failing
warnings.t or Digest-SHA tests (but never on my system!)
else {
const U8 priv = o->op_private;
op_free(o);
- o = newUNOP(OP_ENTEREVAL, priv <<8, newDEFSVOP());
+ /* the newUNOP will recursively call ck_eval(), which will handle
+ * all the stuff at the end of this function, like adding
+ * OP_HINTSEVAL
+ */
+ return newUNOP(OP_ENTEREVAL, priv <<8, newDEFSVOP());
}
o->op_targ = (PADOFFSET)PL_hints;
if (o->op_private & OPpEVAL_BYTES) o->op_targ &= ~HINT_UTF8;
require './test.pl';
}
-plan(tests => 130);
+plan(tests => 132);
eval 'pass();';
is(Internals::SvREFCNT(%$t), $count_expected, 'RT 63110');
}
+# make sure default arg eval only adds a hints hash once to entereval
+#
+{
+ local $_ = "21+12";
+ is(eval, 33, 'argless eval without hints');
+ use feature qw(:5.10);
+ local $_ = "42+24";
+ is(eval, 66, 'argless eval with hints');
+}
+
{
# test that the CV compiled for the eval is freed by checking that no additional
# reference to outside lexicals are made.