|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: info at softmind dot com dot lb
New email:
PHP Version: OS:


 [2006-08-16 09:12 UTC] info at softmind dot com dot lb
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-16 09:43 UTC]
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 for *NIX and 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-2020 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 09:01:24 2020 UTC