Stop pos from panicking when overloading changes UTF8ness
authorFather Chrysostomos <sprout@cpan.org>
Fri, 28 Sep 2012 04:29:33 +0000 (21:29 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 1 Oct 2012 19:51:52 +0000 (12:51 -0700)
commitaec43834c1e29d84920b6d8a41a80fb6c2363487
tree1ed3620a7a1809138deeedb67e5da5845090e82b
parentc9d50bb49b0231aa883d3d0293ef039845f50237
Stop pos from panicking when overloading changes UTF8ness

This touches on issues raised in tickets #114410 and #114690.

If the UTF8ness of an overloaded string changes with each call, it
will make magic_setpos panic if it tries to stringify the SV multiple
times.  We have to avoid any sv-specific utf8 length functions when
it comes to overloading.  And we should do the same thing for gmagic,
too, to avoid creating caches that will shortly be invalidated.

The test class is very closely based on code written by Nicholas Clark
in a response to #114410.
mg.c
sv.h
t/op/utf8cache.t