#38470 [NEW]: Bug when calling odbc_field_type on tinyint and long varchar.

From: Date: Wed, 16 Aug 2006 09:12:14 +0000
Subject: #38470 [NEW]: Bug when calling odbc_field_type on tinyint and long varchar.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-100849@lists.php.net to get a copy of this message
From: info at softmind dot com dot lb Operating system: Win xp sp2 PHP version: 5.1.4 PHP Bug Type: ODBC related Bug description: Bug when calling odbc_field_type on tinyint and long varchar. Description: ------------ Database: ASA (Adaptive Server Anywhere) version 6.x If the column in a table is of type "long varchar" or "tinyint" it is causing the apache server to go down. Otherwise it works fine. As for the "long varchar", the length that is returned is very large, so I was able to check for the size and if it is greate than 1000000, I can find out that it is a long varchar, however, with the tiny int, it returns a length of 3, however, I cannot assume that it is a tinyint, since it could be a CHAR(3) as well. Reproduce code: --------------- // This is a method within an object // $result is the result id returned from odbc_exec function function getFields($result){ $this->object=array(); // clear array $max = odbc_num_fields($result); // get column numbers for ($i=1; $i<=$max; $i++) { $name = odbc_field_name($result,$i); $scale = odbc_field_scale($result,$i); $size = odbc_field_precision($result,$i); // Workaround temporary otherwise, if odbc_field_type is called, then the apache server will crash. $type = $size>1000000?'TEXT':$size==3?'TINYINT':odbc_field_type($result,$i); } } Expected result: ---------------- To receive in the $type variable TINYINT, LONG VARCHAR, etc... Actual result: -------------- Crashing the apache server. -- Edit bug report at http://bugs.php.net/?id=38470&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38470&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38470&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38470&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38470&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38470&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38470&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38470&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38470&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38470&r=support Expected behavior: http://bugs.php.net/fix.php?id=38470&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38470&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38470&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38470&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38470&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38470&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38470&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38470&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38470&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38470&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38470&r=mysqlcfg

« previous php.bugs (#100849) next »