From:             [EMAIL PROTECTED]
Operating system: Win 2000
PHP version:      4.0.6
PHP Bug Type:     Reproducible crash
Bug description:  Exit after an odbc_exec caused crashes.

I've written about 40 php-pages with about 15 classes and everything
worked. (Win 2K, Apache, PHP 4.06, Adabas 12).
In the last days I've copied some of the classes, put them in a new
directory, changed the include directory to include only the new directory
(thus no conflict with the old classes). The following error always
happened:

1. If I use an exit statement after odbc_exec, then apache will pop-up a
"php.exe has generated an error...", in the apache's error log found:
"Premature end of script headers: c:/php/php.exe". Then the browser
switched to 500 Internal Server Error.
2. The odbc_exec has done (partially?) it's work well. Because if the
SQL-Statement is an INSERT one, the entry has been correctly stored in
ADABAS. 
3. If the exit statement omitted, no error throwed (as in script). All of
the exit forms caused crash.
4. My assumption is: the exit statement caused php to cut(end) the thread
process. But the odbc statement (thread?) 
is still running. As the odbc thread come to end, it returns some result to
Apache, which can not find the php-process. ---> premature end.

I hope you can understand the problem (sorry for my bad english).

Greets,
B. Rad

Script:
<?
  include_once("xpdfConstants.php");
  
  function createContract() {

     //execute the query
     $conID = getConnection();
     $sql = "SELECT * FROM \"Contract\"";
     $res = odbc_exec($conID, $sql);
//     exit;
//     exit(-1);
//     exit("ouchh...");
     $rNum = odbc_num_rows($res);
     echo ("<BR>Found $rNum contracts <BR>");

  }
  
  function getConnection() {
    global $DEBUG;
    global $DB_host, $DB_user, $DB_password;

    if (!($connectionID = odbc_connect ($DB_host,$DB_user, $DB_password)))
{
       printError(0, "can not create a connection to $DB_SERVER",
"authenticateUser");
       return -1 ;
    }
    
    return $connectionID;
  }
  
?>
-- 
Edit bug report at: http://bugs.php.net/?id=14040&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to