From:             rober_box at mailforce dot net
Operating system: Gentoo Linux 2005.0
PHP version:      4.3.11
PHP Bug Type:     MySQL related
Bug description:  mysql_field_len() not working with utf-8

Description:
------------
mysql_field_len() doesn't return the correct field len for 
utf-8 fields. Instead it returns the maximum length mysql 
allows (i.e 3 bytes). That way i can't check user input 
for length sanity. 
 
My configuration:  
'./configure' '--prefix=/usr' '--host=i686-pc-linux-gnu' 
'--mandir=/usr/share/man' '--infodir=/usr/share/info' 
'--datadir=/usr/share' '--sysconfdir=/etc' 
'--localstatedir=/var/lib' '--with-apxs2=/usr/sbin/apxs2' 
'--without-db3' '--without-db4' '--without-db2' 
'--without-ndbm' '--with-mcrypt=/usr' '--with-mhash=/usr' 
'--without-interbase' '--without-ming' '--without-swf' 
'--without-sybase' '--with-gdbm=/usr' '--without-fdftk' 
'--without-java' '--without-mcal' '--without-unixODBC' 
'--without-pgsql' '--without-snmp' 
'--with-xpm-dir=/usr/X11R6' '--without-gmp' 
'--without-mssql' '--with-pdflib=/usr' '--with-gd' 
'--enable-gd-native-ttf' '--with-png=/usr' 
'--with-png-dir=/usr' '--with-jpeg=/usr' 
'--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff=/usr' 
'--with-tiff-dir=/usr' '--with-mysql=/usr' 
'--with-mysql-sock=/var/run/mysqld/mysqld.sock' 
'--with-freetype-dir=/usr' '--with-ttf=/usr' 
'--with-t1lib=/usr' '--with-gettext' 
'--with-qtdom=/usr/qt/3' '--with-pspell=/usr' 
'--with-openssl=/usr' '--without-imap' '--without-ldap' 
'--with-dom=/usr' '--with-dom-xslt=/usr' 
'--with-dom-exslt=/usr' '--without-kerberos' '--with-pam' 
'--disable-memory-limit' '--enable-ipv6' '--without-yaz' 
'--disable-debug' '--with-curlwrappers' '--with-curl=/usr' 
'--enable-dbx' '--with-zlib=/usr' '--with-zlib-dir=/usr' 
'--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot' 
'--with-xmlrpc' '--enable-wddx' '--with-xml' 
'--enable-mbstring=all' '--enable-mbregex' 
'--with-bz2=/usr' '--with-crack=/usr' '--with-cdb' 
'--enable-pcntl' '--enable-bcmath' '--enable-calendar' 
'--enable-dbase' '--enable-filepro' '--enable-ftp' 
'--with-mime-magic=/usr/share/misc/file/magic.mime' 
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-sysvmsg' '--with-iconv' '--enable-shmop' 
'--enable-dio' '--enable-yp' '--without-ncurses' 
'--without-readline' '--enable-inline-optimization' 
'--enable-track-vars' '--enable-trans-sid' 
'--enable-versioning' 
'--with-config-file-path=/etc/php/apache2-php4' 
'--without-pear' '--libdir=/usr/lib/php' 
'--with-pear=/usr/lib/php' 
 
 

Reproduce code:
---------------
$fields = mysql_list_fields($link, $table) or msg_error(mysql_error());
$len = mysql_field_len($fields, $i);
echo $len;


Expected result:
----------------
I expect to see the actual length as shown by issuing a 
SHOW FIELDS FROM table query. For example if a field is 
VARHCHAR(8) i expect to see 8, not 24. 

Actual result:
--------------
24 

-- 
Edit bug report at http://bugs.php.net/?id=33123&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33123&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33123&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33123&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33123&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33123&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33123&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33123&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33123&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33123&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33123&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33123&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33123&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33123&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33123&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33123&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33123&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33123&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33123&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33123&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33123&r=mysqlcfg

Reply via email to