php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38470 Bug when calling odbc_field_type on tinyint and long varchar.
Submitted: 2006-08-16 09:12 UTC Modified: 2006-08-24 01:00 UTC
From: info at softmind dot com dot lb Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 5.1.4 OS: Win xp sp2
Private report: No CVE-ID: None
 [2006-08-16 09:12 UTC] info at softmind dot com dot lb
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-16 09:43 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2006-08-24 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC