php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50478 connecting to Firebird makes segmentation fault
Submitted: 2009-12-15 11:16 UTC Modified: 2010-01-11 09:40 UTC
From: nmorozov at atlas-print dot ru Assigned:
Status: Not a bug Package: InterBase related
PHP Version: 5.3.1 OS: FreeBSD 7.x/8.x
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: nmorozov at atlas-print dot ru
New email:
PHP Version: OS:

 

 [2009-12-15 11:16 UTC] nmorozov at atlas-print dot ru
Description:
------------
Im using FreeBSD 8.0 the result on 7.x is the same
My Firebird client version is 2.0.3 server have Yaffil (Firebird 1.5 modification)

Trying to connect using 
ibase_connect($database,$user,$pass,'WIN1251','100','3')
make a segmentation fault into apache 2.2.14 log
script produce nothing

Trying to use PDO
$conn = new PDO("firebird:dbname=".$database,$user,$pass);
this produce the same trash

Some time ago a have an earlier version on PHP and Firebird client 1.5.3 and have no problem. But it is not a firebird problem because my C program that communicates with firebird have no problem.

Trying to resolv it, I try to fix it myself editing ext/interbase/interbase.c

First i comment isc_attach_db function, and the is no more faults.
The next i rewrite the _php_ibase_attach_db function the same way that I use in my C code, but i change nothing. Possible Error is in the data manipulation  after connection because structures changed to version 2.0/2.1

PS. Maybe I need to repost it as and PDO bug also ?

Reproduce code:
---------------
ibase_connect($database,$user,$pass,'WIN1251','100','3')

$conn = new PDO("firebird:dbname=".$database,$user,$pass);

Actual result:
--------------
segmentation fault in apache 2.2.14 log

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-15 11:42 UTC] iliaa@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.


 [2009-12-15 12:19 UTC] nmorozov at atlas-print dot ru
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 28401140 (LWP 100105)]
0x28e33e0f in ThreadData::restoreSpecific ()
   from /usr/local/lib/libfbclient.so.2
(gdb) bt
#0  0x28e33e0f in ThreadData::restoreSpecific ()
   from /usr/local/lib/libfbclient.so.2
#1  0x28e48c6f in return_success () from /usr/local/lib/libfbclient.so.2
#2  0x28e5062a in REM_attach_database () from /usr/local/lib/libfbclient.so.2
#3  0x28e3db2b in isc_attach_database () from /usr/local/lib/libfbclient.so.2
#4  0x287c0c7c in _php_ibase_attach_db (args=0xbfbfceb4, len=0xbfbfcea0,
    largs=0xbfbfce94, db=0xbfbfcde8)
    at /usr/local/src/php-5.3.1/ext/interbase/interbase.c:887
#5  0x287c122c in _php_ibase_connect (ht=6, return_value=0x29515a48,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, persistent=0)
    at /usr/local/src/php-5.3.1/ext/interbase/interbase.c:991
#6  0x287c14c5 in zif_ibase_connect (ht=6, return_value=0x29515a48,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /usr/local/src/php-5.3.1/ext/interbase/interbase.c:1038
#7  0x28a18746 in zend_do_fcall_common_helper_SPEC (execute_data=0x296a8040)
    at zend_vm_execute.h:313
#8  0x28a1d7b8 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x296a8040)
    at zend_vm_execute.h:1602
#9  0x28a17acb in execute (op_array=0x29694380) at zend_vm_execute.h:104
#10 0x289ebdf7 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/local/src/php-5.3.1/Zend/zend.c:1194
#11 0x28981105 in php_execute_script (primary_file=0xbfbfe604)
    at /usr/local/src/php-5.3.1/main/main.c:2225
#12 0x28ab6ad3 in php_handler (r=0x2969d058)
    at /usr/local/src/php-5.3.1/sapi/apache2handler/sapi_apache2.c:648
#13 0x080768d9 in ap_run_handler (r=0x2969d058) at config.c:157
#14 0x08079ba7 in ap_invoke_handler (r=0x2969d058) at config.c:372
#15 0x080909a0 in ap_process_request (r=0x2969d058) at http_request.c:282
#16 0x0808db9b in ap_process_http_connection (c=0x296991f0) at http_core.c:190
#17 0x0807dbb9 in ap_run_process_connection (c=0x296991f0) at connection.c:43
#18 0x080a452e in child_main (child_num_arg=Variable "child_num_arg" is not ava
lable.
) at prefork.c:662
#19 0x080a4773 in make_child (s=0x28415c40, slot=0) at prefork.c:702
#20 0x080a5321 in ap_mpm_run (_pconf=0x2840f018, plog=0x2844d018,
    s=0x28415c40) at prefork.c:978
#21 0x080640e5 in main (argc=675336216, argv=0x29697018) at main.c:740

(gdb) frame 9
#9  0x28a17acb in execute (op_array=0x29694380) at zend_vm_execute.h:104
104                     if ((ret = EX(opline)->handler(execute_data TSRMLS_CC))
> 0) {
 [2009-12-16 00:52 UTC] felipe@php.net
I cannot reproduce the crash on Linux 32bit using Firebird 2.0.4.
 [2009-12-16 08:40 UTC] nmorozov at atlas-print dot ru
I have discover the problem. But very strange thing discovered.
PHP is linked with -lfbclient, but my working program is linked with -lgds (libgds.so is symlink to libfbembed.so.2.0.3). I just manyaly edit Makefile (replace -lfbclient to -lgds) and PHP becomes working.

My versions ...
Maybe gds points to compatible lib ? Maybe something wrong with fbclient lib in freebsd port ?
 [2010-01-11 09:40 UTC] jani@php.net
Bad library installations are not PHP bugs.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Apr 28 17:01:33 2025 UTC