php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53007 crash when result set contains NULL
Submitted: 2010-10-07 02:06 UTC Modified: 2010-10-30 09:41 UTC
From: crewone at gmail dot com Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 5.3.3 OS: ubuntu 10.4 amd64
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: crewone at gmail dot com
New email:
PHP Version: OS:

 

 [2010-10-07 02:06 UTC] crewone at gmail dot com
Description:
------------
PHP (CLI) crashes (Segfault) on a NULL in the result set.

- latest easysoft odbc-odbc bridge and unixODBC-2.3.0 (compiled from source) 
- php-5.3.3 compiled from source (--with-unixODBC)

Database is a PROGRESS OPENEDGE 10.1C database.

Actual result:
--------------
#0  0x00007ffff5386085 in memcpy () from /lib/libc.so.6
#1  0x00000000006dee08 in _estrndup (s=0x1331c08 "\030\034\063\001", length=
<value optimized out>) at /usr/include/bits/string3.h:52
#2  0x0000000000579b6a in zif_odbc_result (ht=<value optimized out>, 
return_value=0x1332c60, return_value_ptr=<value optimized out>, this_ptr=<value 
optimized out>, return_value_used=<value optimized out>)
    at /usr/src/php-5.3.3/ext/odbc/php_odbc.c:2110
#3  0x0000000000746a3c in zend_do_fcall_common_helper_SPEC 
(execute_data=0x7ffff7e8ab58) at /usr/src/php-5.3.3/Zend/zend_vm_execute.h:316
#4  0x000000000071ebd8 in execute (op_array=0x10b4380) at /usr/src/php-
5.3.3/Zend/zend_vm_execute.h:107
#5  0x00000000006f982a in zend_execute_scripts (type=8, retval=<value optimized 
out>, file_count=3) at /usr/src/php-5.3.3/Zend/zend.c:1194
#6  0x00000000006a80ed in php_execute_script (primary_file=<value optimized 
out>) at /usr/src/php-5.3.3/main/main.c:2260
#7  0x000000000078064e in main (argc=<value optimized out>, argv=<value 
optimized out>) at /usr/src/php-5.3.3/sapi/cli/php_cli.c:1192

Patches

create-odbc-null-crash.patch (last revision 2010-10-07 07:22 UTC by crewone at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-07 02:26 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2010-10-07 02:26 UTC] felipe@php.net
Duplicated of bug #52554
 [2010-10-30 00:53 UTC] lindoja at juno dot com
I've also experienced ODBC crashing PHP when the result set contains a Null (and sometimes even when it does not).  This occurs when accessing NUMBER fields in a Pervasive database via an ODBC DSN.

The workaround I found is to add zero or an empty string to the start of the results rather than returning them directly.

i.e. instead of 'Select "MyNumber","MyString" FROM "MyTable"', you'd do this:
'Select 0 + "MyNumber" As "MyNumber", '' + "MyString" As "MyString" FROM "MyTable"'
 [2010-10-30 09:41 UTC] crewone at gmail dot com
Weird that nobody seems to fix this, even though the fix is simple and available.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 08 03:01:29 2025 UTC