php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14040 Exit after an odbc_exec caused crashes.
Submitted: 2001-11-13 08:44 UTC Modified: 2002-05-22 15:20 UTC
From: br4d at yahoo dot com Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.0.6 OS: Win 2000
Private report: No CVE-ID: None
 [2001-11-13 08:44 UTC] br4d at yahoo dot com
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;
  }
  
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-22 15:20 UTC] kalowsky@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC