#22709 [Opn->Fbk]: Sometime crash when database unavailable

From: Date: Sat, 15 Mar 2003 01:27:12 +0000
Subject: #22709 [Opn->Fbk]: Sometime crash when database unavailable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-35650@lists.php.net to get a copy of this message
ID: 22709 Updated by: sniper@php.net Reported By: Vladimir dot Michl at seznam dot cz -Status: Open +Status: Feedback Bug Type: InterBase related Operating System: Any PHP Version: 4.3.2RC1 New Comment: Are you really using 4.3.2RC1? Where did you get it? :) In any case, please provide any patches in the unified diff format. ( diff -u ) Previous Comments: ------------------------------------------------------------------------ [2003-03-14 13:40:53] Vladimir dot Michl at seznam dot cz PHP sometime crash, when interbase database go to unavailable during script execution. Problem is, when get_link_trans return NULL in ib_link. I localise problem and here is fix (fixed in _php_ibase_def_trans and _php_ibase_trans_end): *** interbase.c.orig Fri Mar 14 14:11:51 2003 --- interbase.c Fri Mar 14 14:21:47 2003 *************** *** 1572,1578 **** { TSRMLS_FETCH(); ! if (trans_n == 0 && ib_link->trans[0] == NULL) { if (isc_start_transaction(IB_STATUS, &ib_link->trans[0], 1, &ib_link->link, 0, NULL)) { _php_ibase_error(); return FAILURE; --- 1572,1582 ---- { TSRMLS_FETCH(); ! if (ib_link == NULL){ ! php_error(E_WARNING, "Database link is not valid"); ! return FAILURE; ! }; ! if (trans_n == 0 && ib_link->trans[0] == NULL) { if (isc_start_transaction(IB_STATUS, &ib_link->trans[0], 1, &ib_link->link, 0, NULL)) { _php_ibase_error(); return FAILURE; *************** *** 1609,1614 **** --- 1613,1622 ---- break; } + if (ib_link == NULL) { + php_error(E_WARNING, "Database link is not valid"); + RETURN_FALSE; + } if (ib_link->trans[trans_n] == NULL) { php_error(E_WARNING, "Trying to commit or rollback an already handled transaction"); RETURN_FALSE; ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22709&edit=1

« previous php.bugs (#35650) next »