php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42054 odbc_result() crashes with NULL values
Submitted: 2007-07-20 16:42 UTC Modified: 2007-07-24 14:37 UTC
From: battisti at actgate dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.4.7 OS: Red Hat Enterprise Linux WS rele
Private report: No CVE-ID: None
 [2007-07-20 16:42 UTC] battisti at actgate dot com
Description:
------------
The odbc_result() function crashes if the value requested is a NULL value in the DB.

Tested on: RHEL 4 WS   64 bit
Architecture: x86_64
PHP version: 4.3.9
DB: PostgreSQL 8.2.4
unixODBC: 2.2.9 


$field_value = odbc_result($this->Query_ID, $i );

where $i is an index of a NULL value in the DB.

Reproduce code:
---------------
$field_value = odbc_result($this->Query_ID, $i );

where $i is an index of a NULL value in the DB.

Expected result:
----------------
$field_value == "" or "NULL" or ERROR, but I do not expect a crash :)

Actual result:
--------------
Simply a crash!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-20 23:16 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

And I also suggest using the PDO ODBC driver instead..
 [2007-07-23 11:05 UTC] battisti at actgate dot com
I compiled the latest snapshot, (php5.2-200707230830)
on a test machine (Fedora Core 3, 32 bit ) and the problem has disappeared...

Now, before upgrading the PHP installation on the production machine, I would like to know since what stable version this problem has been fixed (I cannot install 5.2.4-dev there...).

Also, I'm not sure if the problem could be related to the fact that the test machine is 32 bit, and the producion one is 64 bit.

Any advice?
Thank you very much!
 [2007-07-24 14:37 UTC] battisti at actgate dot com
The problem has disappeared using PHP 5.1.6 packaged by CentOS people.

Thanks.

http://mirror.centos.org/centos/4/centosplus/x86_64/RPMS/
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 17:01:33 2024 UTC