From:             tma at 2p dot cz
Operating system: Win98
PHP version:      4.3.4
PHP Bug Type:     Reproducible crash
Bug description:  Intarbase fetch record of wide field freeze PHP execution 

Description:
------------
It seems there is some problem when fetching interbase records containing
a wide field.

Execution of PHP code is frozen at random point - probably some memory
problem. Point of freezing depends on number of fetched records. 

Does not matter if ibase_fetch_row/assoc/object is used. There is one
presumtion - must be selected a field that is type of VARCHAR(200). I did
not test what is critical field length. There are in field national chars
but this occurs even pure english chars are used (#32..#127)(first I've
used UNICODE_FSS and thought that problem is in unicode). If this wide
column is not listed it works (SELECT ID,ID as NAME). 

Does not matter if NAME's CHARACTER SET is ASCII or UNICODE_FSS

CREATE TABLE TBL (
       ID VARCHAR(10) CHARACTER SET ASCII NOT NULL,
       NAME VARCHAR(200) CHARACTER SET ASCII /* UNICODE_FSS*/ NOT NULL,
       PARENT_ID VARCHAR(10) CHARACTER SET ASCII,
     CONSTRAINT GROUPS_PK PRIMARY KEY (ID)
);

Note:
Problem is neither in IBServer nor in IBClient. When using windows based
apps using gds32.dll it works.

I cannot fix it by myself because I have not MS-C to compile module for
Windows and I'm not expert for CYGWIN environment.

Reproduce code:
---------------
function CleanUp() {
global $IB_HANDLE;
  if ($IB_HANDLE) {
    echo "close\n";
    IBase_Close($IB_HANDLE);
    echo "close done\n";
  }
}
Register_ShutDown_Function('CleanUp');

$maxn = 1000;  // limit max num. of listed records

Dl('php_interbase.dll');
$IB_HANDLE = IBase_Connect (IB_HOST, IB_USER, IB_PASSWORD);

$query = IBase_Query($IB_HANDLE, "SELECT * FROM TBL");
$n = 0;  while ($res = IBase_Fetch_Assoc($query)) {
      echo "$n.";
      printf("%s: %s\n", $res['ID'], $res['NAME']); 
      Flush();  // no effect
      Unset($res);
      $n++;
      if ($n > $maxn) {
        break;
      }
    }
echo "loop done\n";
IBase_Free_Result($query);
echo "free query done\n";


Expected result:
----------------
-open ibase
-open SQL
-list table records.
-close SQL
-close ibase

Actual result:
--------------
Execution of PHP code is frozen at random point - probably some memory
problem. Point of freeze depends on number of fetched records. For example
in my environment if $maxn < 6 it works, if $maxn < 100 it's frozen in
when ibase_free_result in action - if this line is commented is frozen
during ibase_close. If $maxn = 1000 is frozen when listing record 355. But
this depends on output and ASCII/UNICODE_FSS.

Notes:

Execution is frozen because time_limit has no effect.

If was script executed from Apache as CGI and execution was stopped from
browser there was still connection to IBServer. If was executed from
command line and pressed Ctrl+C when frozen, connection was closed

It's not time_limit or output problem, this occurs only if ibase_fetch_*
called.

-- 
Edit bug report at http://bugs.php.net/?id=26298&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26298&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26298&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26298&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26298&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26298&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=26298&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26298&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26298&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26298&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26298&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26298&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26298&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26298&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26298&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26298&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26298&r=float

Reply via email to