php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26298 Intarbase fetch record of wide field freeze PHP execution
Submitted: 2003-11-18 06:36 UTC Modified: 2003-11-18 08:08 UTC
From: tma at 2p dot cz Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.3.4 OS: Win98
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tma at 2p dot cz
New email:
PHP Version: OS:

 

 [2003-11-18 06:36 UTC] tma at 2p dot cz
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-18 07:45 UTC] abies@php.net
This exact sample script works fine on Windows 2000 with 
Firebird 1.0.3 & CLI php4. [25+ runs with both Debug and 
Release builds] 
 
 
 
 
 
 [2003-11-18 07:54 UTC] tma at 2p dot cz
Did you check it with data in table? How much?
 [2003-11-18 08:08 UTC] abies@php.net
1000 records 
 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC