#22709 [NEW]: Sometime crash when database unavailable

From: Date: Fri, 14 Mar 2003 19:40:53 +0000
Subject: #22709 [NEW]: Sometime crash when database unavailable
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-35621@lists.php.net to get a copy of this message
From:             Vladimir dot Michl at seznam dot cz
Operating system: Any
PHP version:      4.3.2RC1
PHP Bug Type:     InterBase related
Bug description:  Sometime crash when database unavailable

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 bug report at http://bugs.php.net/?id=22709&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22709&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22709&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22709&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22709&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22709&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22709&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22709&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22709&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22709&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22709&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22709&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22709&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22709&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22709&r=gnused



Thread (4 messages)

« previous php.bugs (#35621) next »