#else /* A_WORKAROUND_REQUIRE_PROPAGATION */
#define a_tag(B) newSVuv(B)
-#define a_detag(H) (((H) && SvOK(H)) ? SvUVX(H) : 0)
+/* PVs fetched from the hints chain have their SvLEN set to zero, so get the UV
+ * from a copy. */
+#define a_detag(H) \
+ ((H) \
+ ? (SvIOK(H) \
+ ? SvUVX(H) \
+ : (SvPOK(H) \
+ ? sv_2uv(SvLEN(H) ? (H) : sv_mortalcopy(H)) \
+ : 0 \
+ ) \
+ ) \
+ : 0)
#endif /* !A_WORKAROUND_REQUIRE_PROPAGATION */
defined = TRUE;
break;
default:
- defined = SvOK(sv);
+ SvGETMAGIC(sv);
+ if (SvOK(sv))
+ defined = TRUE;
}
return defined;
flags = oi.flags;
if (flags & A_HINT_DEREF) {
- if (!SvOK(TOPs)) {
+ if (!a_defined(TOPs)) {
/* We always need to push an empty array to fool the pp_aelem() that comes
* later. */
SV *av;
flags = oi.flags;
if (flags & A_HINT_DEREF) {
- if (!SvOK(TOPs))
+ if (!a_defined(TOPs))
RETURN;
} else {
PL_op->op_ppaddr = oi.old_pp;
flags = oi.flags;
if (flags & A_HINT_DEREF) {
- if (!SvOK(TOPs)) {
+ if (!a_defined(TOPs)) {
SV *hv;
POPs;
hv = sv_2mortal((SV *) newHV());
if (flags & (A_HINT_NOTIFY|A_HINT_STORE)) {
SPAGAIN;
- if (!SvOK(TOPs)) {
+ if (!a_defined(TOPs)) {
if (flags & A_HINT_STRICT)
croak("Reference vivification forbidden");
else if (flags & A_HINT_WARN)