Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8 overload stringify bug (utf8 caching maybe) #7822

Closed
p5pRT opened this issue Mar 1, 2005 · 3 comments
Closed

utf8 overload stringify bug (utf8 caching maybe) #7822

p5pRT opened this issue Mar 1, 2005 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 1, 2005

Migrated from rt.perl.org#34297 (status was 'resolved')

Searchable as RT34297$

@p5pRT
Copy link
Author

p5pRT commented Mar 1, 2005

From @perlpunk

in the following testcase, length() does not return the correct value (at
least not at the first time).
first it outputs 5 (which is wrong as it has the UTF8 flag set), then
following calls of length return 4.

---snip---

package UTF8Field;
use strict;
use warnings;
use Encode();
use Devel​::Peek;

use overload '""' => 'stringify';

sub new {
  my $class = shift;
  my $new = shift;
  return bless \$new, $class;
}
sub stringify {
  my $self = shift;
  my $str = Encode​::decode("utf8", $$self);
  Dump $str;
  warn "str​: $str l​: " . length($str) ."\n";
  return $str;
}

package main;
use Devel​::Peek;
use strict;
use warnings;
binmode STDOUT, "​:utf8";

my $t = "B\303\266se";

my $u = UTF8Field->new($t);
print length $u, "\n";
print length $u, "\n";

---snip---

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl v5.8.6:

Configured by tina at Thu Feb 24 12:53:27 CET 2005.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
    osname=linux, osvers=2.6.4-52-default, archname=i686-linux
    uname='linux lux 2.6.4-52-default #1 wed apr 7 02:08:30 utc 2004 i686
athlon i386 gnulinux '
    config_args='-e'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.3.3 (SuSE Linux)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.3'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:



@INC for perl v5.8.6:
    /usr/local/lib/perl5/5.8.6/i686-linux
    /usr/local/lib/perl5/5.8.6
    /usr/local/lib/perl5/site_perl/5.8.6/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.6
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.8.6:
    HOME=/home/tina
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin
    PERL5LIB=
    PERL_BADLANG (unset)
    SHELL=/bin/bash



@p5pRT
Copy link
Author

p5pRT commented Apr 28, 2006

From @nwc10

Sorry for the delay. This bug is fixed with change 28006, which I expect will
be merged across into 5.8.9

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Apr 28, 2006

@nwc10 - Status changed from 'new' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant