|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-14 13:40 UTC] 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;
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 09:00:02 2025 UTC |
Really, I test it on 4.2.3 but if I see to CVS, to interbase.c, this bug is not fixed. I discover this bug in php 4.1.1, but now I have time to locate problem. I have experience, that PHP team if see too old version of PHP that reject patch. Patch may fix some problem, not fixed in actual version, but too old version of PHP -> reject patch. See to source: get_link_trans may return NULL in ib_link, but code after call get_link_trans not handle this situation. Here is path in unified diff: --- interbase.c.orig Fri Mar 14 14:11:51 2003 +++ interbase.c Fri Mar 14 14:21:47 2003 @@ -1572,7 +1572,11 @@ { TSRMLS_FETCH(); - if (trans_n == 0 && ib_link->trans[0] == NULL) { + 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,6 +1613,10 @@ 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;