From: Vincent Pit Date: Sat, 6 Dec 2008 01:18:38 +0000 (+0100) Subject: Really fix the "${\(new Hlagh)}" bug by ensuring that the kid of a rv2sv is a SVOP... X-Git-Tag: v0.09_01~3 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=574d2ca938e5c479fbc2b24c0f306f7f55e38cc2;p=perl%2Fmodules%2Findirect.git Really fix the "${\(new Hlagh)}" bug by ensuring that the kid of a rv2sv is a SVOP before looking for its sv --- diff --git a/indirect.xs b/indirect.xs index ad4a23f..c89c8b9 100644 --- a/indirect.xs +++ b/indirect.xs @@ -203,8 +203,9 @@ STATIC OP *indirect_ck_rv2sv(pTHX_ OP *o) { SV *sv; const char *name = NULL, *s; STRLEN len; + OPCODE type = op->op_type; - switch (op->op_type) { + switch (type) { case OP_GV: case OP_GVSV: { GV *gv = cGVOPx_gv(op); @@ -212,12 +213,12 @@ STATIC OP *indirect_ck_rv2sv(pTHX_ OP *o) { len = GvNAMELEN(gv); break; } - default: { - SV *sv = cSVOPx_sv(op); - if (SvPOK(sv) && (SvTYPE(sv) >= SVt_PV)) - name = SvPV_const(sv, len); - break; - } + default: + if ((PL_opargs[type] & OA_CLASS_MASK) == OA_SVOP) { + SV *sv = cSVOPx_sv(op); + if (SvPOK(sv) && (SvTYPE(sv) >= SVt_PV)) + name = SvPV_const(sv, len); + } } if (!name) goto done; diff --git a/t/10-good.t b/t/10-good.t index 91b1ac0..d428d1f 100644 --- a/t/10-good.t +++ b/t/10-good.t @@ -171,7 +171,7 @@ print $z "hlagh\n"; print STDOUT "bananananananana\n"; #### $x->foo($pkg->$cb) -#### "seems to segfault with strict libc implementations" # +#### $obj = "apple ${\(new Hlagh)} pear" #### $obj = "apple @{[new Hlagh]} pear"