PHP5 FREETDS

Bug #127158 reported by Umberto Zanatta
2
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: php5

when I try to connect via freetds into a SQL server with odbc_connect function, apache2 crash.

The Server runs with Ubuntu Edgy x86_64.

ISQL works fine.

Here you test and error:

<?php

$user = 'xxx';
$pass = 'yyyy';

$dsn = "PROVA"; // db metodo per tests

$connect = odbc_connect( $dsn, $user, $pass );
print "odbc conn: ". $connect ."<br>";

$result = odbc_tables($connect);
print "odbc result: ". $result;

// close the connection
odbc_close($connect);

?>

oot@localhost :/var/www/webroot# php ./odbctest.php
odbc conn: Resource id #4<br>odbc result: Resource id #5*** glibc detected *** php: free(): invalid pointer: 0x0000000000c00430 ***
======= Backtrace: =========
/lib/libc.so.6[0x2b8a740d3733]
/lib/libc.so.6(__libc_free+0x84)[0x2b8a740d38b4]
php(_efree+0xbc)[0x60390c]
/usr/lib/php5/20051025/odbc.so[0x2b8a75e90b83]
php(list_entry_destructor+0x7e)[0x62762e]
php(zend_hash_del_key_or_index+0x259)[0x626c79]
php(_zend_list_delete+0x79)[0x6278a9]
/usr/lib/php5/20051025/odbc.so(zif_odbc_close+0xd5)[0x2b8a75e90e45]
php[0x647a62]
php(execute+0x18c)[0x637b2c]
php(zend_execute_scripts+0x15e)[0x61abee]
php(php_execute_script+0x247)[0x5dd2c7]
php(main+0x1140)[0x6a1610]
/lib/libc.so.6(__libc_start_main+0xf4)[0x2b8a740820c4]
php[0x454639]
======= Memory map: ========
00400000-0087e000 r-xp 00000000 68:06 269225222 /usr/bin/php5
0097d000-00a16000 rw-p 0047d000 68:06 269225222 /usr/bin/php5
00a16000-00c35000 rw-p 00a16000 00:00 0 [heap]
2b8a72868000-2b8a72884000 r-xp 00000000 68:06 301990184 /lib/ld- 2.4.so
2b8a72884000-2b8a72887000 rw-p 2b8a72884000 00:00 0
2b8a72983000-2b8a72985000 rw-p 0001b000 68:06 301990184 /lib/ld-2.4.so
2b8a72985000-2b8a7298a000 r-xp 00000000 68:06 301990189 /lib/libcrypt- 2.4.so
2b8a7298a000-2b8a72a89000 ---p 00005000 68:06 301990189 /lib/libcrypt-2.4.so
2b8a72a89000-2b8a72a8b000 rw-p 00004000 68:06 301990189 /lib/libcrypt- 2.4.so
2b8a72a8b000-2b8a72ab9000 rw-p 2b8a72a8b000 00:00 0
2b8a72ab9000-2b8a72abc000 r-xp 00000000 68:06 369098909 /usr/lib/libpanel.so.5.5
2b8a72abc000-2b8a72bbb000 ---p 00003000 68:06 369098909 /usr/lib/libpanel.so.5.5
2b8a72bbb000-2b8a72bbc000 rw-p 00002000 68:06 369098909 /usr/lib/libpanel.so.5.5
2b8a72bbc000-2b8a72c08000 r-xp 00000000 68:06 301990145 /lib/libncurses.so.5.5
2b8a72c08000-2b8a72d08000 ---p 0004c000 68:06 301990145 /lib/libncurses.so.5.5
2b8a72d08000-2b8a72d16000 rw-p 0004c000 68:06 301990145 /lib/libncurses.so.5.5
2b8a72d16000-2b8a72d17000 rw-p 2b8a72d16000 00:00 0
2b8a72d17000-2b8a72d58000 r-xp 00000000 68:06 369103696 /usr/lib/libssl.so.0.9.8
2b8a72d58000-2b8a72e58000 ---p 00041000 68:06 369103696 /usr/lib/libssl.so.0.9.8
2b8a72e58000-2b8a72e5e000 rw-p 00041000 68:06 369103696 /usr/lib/libssl.so.0.9.8
2b8a72e5e000-2b8a72e5f000 rw-p 2b8a72e5e000 00:00 0
2b8a72e5f000-2b8a72f4e000 r-xp 00000000 68:06 369098894 /usr/lib/libdb-4.3.so
2b8a72f4e000-2b8a7304e000 ---p 000ef000 68:06 369098894 /usr/lib/libdb- 4.3.so
2b8a7304e000-2b8a73053000 rw-p 000ef000 68:06 369098894 /usr/lib/libdb-4.3.so
2b8a73053000-2b8a73058000 r-xp 00000000 68:06 369099057 /usr/lib/libgdbm.so.3.0.0
2b8a73058000-2b8a73157000 ---p 00005000 68:06 369099057 /usr/lib/libgdbm.so.3.0.0
2b8a73157000-2b8a73158000 rw-p 00004000 68:06 369099057 /usr/lib/libgdbm.so.3.0.0
2b8a73158000-2b8a73167000 r-xp 00000000 68:06 301990206 /lib/libbz2.so.1.0.3
2b8a73167000-2b8a73266000 ---p 0000f000 68:06 301990206 /lib/libbz2.so.1.0.3
2b8a73266000-2b8a73268000 rw-p 0000e000 68:06 301990206 /lib/libbz2.so.1.0.3
2b8a73268000-2b8a73269000 rw-p 2b8a73268000 00:00 0
2b8a73269000-2b8a7327f000 r-xp 00000000 68:06 369185270 /usr/lib/libpcre.so.3.12.0
2b8a7327f000-2b8a7337f000 ---p 00016000 68:06 369185270 /usr/lib/libpcre.so.3.12.0
2b8a7337f000-2b8a73396000 rw-p 00016000 68:06 369185270 /usr/lib/libpcre.so.3.12.0
2b8a73396000-2b8a733a7000 r-xp 00000000 68:06 301990555 /lib/libresolv-2.4.so
2b8a733a7000-2b8a734a7000 ---p 00011000 68:06 301990555 /lib/libresolv- 2.4.so
2b8a734a7000-2b8a734a9000 rw-p 00011000 68:06 301990555 /lib/libresolv-2.4.so
2b8a73Aborted

Revision history for this message
Soren Hansen (soren) wrote :

The way I read it, it doesn't happen until you odbc_close($connect); ? Is that right? Can you test with a more recent version of Ubuntu? Either Feisty or Gutsy will do.

Changed in php5:
status: New → Incomplete
Revision history for this message
Umberto Zanatta (umberto-z) wrote :

No it happens when you call any odbc_* function, but odbc_connect and odbc_close.

To avoid that, I recompiled php with mssql support as i found around forums (it made php5-mssql package). Now it's work fine by calling mssql_* functions.
Odbc still refuses to work.

Thanx.

Revision history for this message
Soren Hansen (soren) wrote : Re: [Bug 127158] Re: PHP5 FREETDS

On Wed, Aug 29, 2007 at 12:59:08PM -0000, Umberto Zanatta wrote:
> No it happens when you call any odbc_* function, but odbc_connect and
> odbc_close.

How do you figure that?

Your example says:
oot@localhost :/var/www/webroot# php ./odbctest.php
odbc conn: Resource id #4<br>odbc result: Resource id #5[...]

"odbc result" is echoed after both odbc_connect and odbc_tables has been
called. The only function call after that is odbc_close, so that must be
what is causing the bug, right?

--
Soren Hansen
Ubuntu Server Team
http://www.ubuntu.com/

Revision history for this message
Umberto Zanatta (umberto-z) wrote :

Actually, you can remove odbc_close and it doesn't work as well.

I had been trying to avoid the problem but the only way that i found it has been to recompile php5 from ubuntu source with mssql support.

regards.

Revision history for this message
Soren Hansen (soren) wrote :

On Wed, Aug 29, 2007 at 01:27:18PM -0000, Umberto Zanatta wrote:
> Actually, you can remove odbc_close and it doesn't work as well.

So it just breaks when the script terminates?

--
Soren Hansen
Ubuntu Server Team
http://www.ubuntu.com/

Revision history for this message
Umberto Zanatta (umberto-z) wrote :

Yes, it does!

Regards.

Revision history for this message
Soren Hansen (soren) wrote :

On Wed, Aug 29, 2007 at 01:54:46PM -0000, Umberto Zanatta wrote:
> Yes, it does!

Ah, ok. Your report just implied that any odbc_* call would fail, which
clearly wasn't the case. You wouldn't happen to have php5-curl
installed, would you? If so, we might be looking at the same problem as
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/63141

--
Soren Hansen
Ubuntu Server Team
http://www.ubuntu.com/

Revision history for this message
Umberto Zanatta (umberto-z) wrote :

php5-curl is not installed.

here you list:

php5 5.1.6-1ubuntu2 server-side, HTML-embedded scripting languag
php5-cgi 5.1.6-1ubuntu2 server-side, HTML-embedded scripting languag
php5-cli 5.1.6-1ubuntu2 command-line interpreter for the php5 script
php5-common 5.1.6-1ubuntu2 Common files for packages built from the php
php5-gd 5.1.6-1ubuntu2 GD module for php5
php5-mssql 5.1.6-1ubuntu2 MSSQL module for php5
php5-mysql 5.1.6-1ubuntu2 MySQL module for php5
php5-mysqli 5.1.6-1ubuntu2 MySQL Improved module for php5
php5-odbc 5.1.6-1ubuntu2 ODBC module for php5

Revision history for this message
Soren Hansen (soren) wrote :

Would it be possible for you to test this from a Feisty or Gutsy system? If you don't have a spare machine, you can do it from a LiveCD.

Revision history for this message
Gareth Fitzworthington (mapping-gp-deactivatedaccount) wrote :

We are closing this report (no response to request for information). To reopen the report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in php5:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.