diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-12-25 00:16:21 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-12-25 00:16:21 -0800 |
commit | 3825652ddfd2e6e7a10980ece6f9a732388cbecf (patch) | |
tree | 97973ad16215f8ddf0bc57ef0bbae24567349241 /universal.c | |
parent | 7f9aa7d32945332aeb1251c905307d22abfd4da5 (diff) | |
download | perl-3825652ddfd2e6e7a10980ece6f9a732388cbecf.tar.gz |
PerlIO::get_layers: Treat numbers as strings
PerlIO::get_layers should not be ignoring an argument like 12, but
treating "12" (the string) as a filehandle, as those are both the
same value.
It’s an instance of the string/num bug, which is a bit like the
Unicode Bug.
This commit takes the conservative approach of expanding it to flat
scalars in general, but not references (in case we decide to do
something interesting later on, even though I think that would be a
bad idea).
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/universal.c b/universal.c index 36800b8196..9d743abaaa 100644 --- a/universal.c +++ b/universal.c @@ -1006,7 +1006,7 @@ XS(XS_PerlIO_get_layers) sv = POPs; gv = MAYBE_DEREF_GV(sv); - if (!gv && SvPOKp(sv)) + if (!gv && !SvROK(sv)) gv = gv_fetchsv_nomg(sv, 0, SVt_PVIO); if (gv && (io = GvIO(gv))) { |