Bug #10997 Updated: Bad SQL query caused SegFault
| From: | kalowsky@php.net | Date: | Thu, 14 Jun 2001 19:38:03 +0000 |
| Subject: | Bug #10997 Updated: Bad SQL query caused SegFault | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-56788@lists.php.net to get a copy of this message | ||
ID: 10997
Updated by: kalowsky
Reported By: peter.valkov@total-graphics.com
Status: Open
Old-Bug Type: HTTP related
Bug Type: OCI8 related
Operating system:
PHP Version: 4.0.5
Assigned To:
Comments:
reclassified to an OCI bug, as that is what this is...updated Short Desc as well...
Previous Comments:
---------------------------------------------------------------------------
[2001-05-28 07:02:51] peter.valkov@total-graphics.com
If script is executed on PHP 4.0.4pl1 there is warning in Apache errof_log file:
Warning: failed to rollback outstanding transactions!: ORA-24324: service handle not initialized
---------------------------------------------------------------------------
[2001-05-28 06:46:58] peter.valkov@total-graphics.com
I tryed to reproduce this and here is the script.
I run 2 different SQL statements. First one is wrong (contains invalid table name) and second is
correct. If there is an error in SQL statement script is terminated using die().
On next page hit after execution of wrong SQL statement i'm getting:
[notice] child pid 7358 exit signal Segmentation fault (11)
in Apache error_log file and mess in defined constants.
In the original script there is no wrong SQL statements but somehow i'm getting same result.
Obviously the problem is in OCI8 extention not in HTTP redirections.
There is no problems running same script on PHP 4.0.4pl1.
<?php
define("CONSTANT", "value");
define("MAX_REDIRECTS", 10);
define("LOGIN", "scott");
define("PASSWORD", "tiger");
define("DB", "oracle");
if (CONSTANT != "value") die($hitNo." failed."."<br> <a
href='".$SCRIPT_NAME."?hitNo=".$hitNo."'>Click to
continue.</a><br>");
$sql[0] = "select * from session_Log where userID=1";
$sql[1] = "select * from sessionLog where userID=1";
$hitNo = $hitNo ? $hitNo+1 : 1;
function ociSelect(&$data) {
global $sql, $hitNo, $SCRIPT_NAME;
$conn = ociNLogon(LOGIN, PASSWORD, DB);
if ($stmt = ociParse($conn, $sql[$hitNo % 2])) {
if (!@ociExecute($stmt,OCI_DEFAULT)) {
$error = ociError($stmt);
die($error["message"]."<br> <a
href='".$SCRIPT_NAME."?hitNo=".$hitNo."'>Click to
continue.</a><br>");
}
$nrows = ociFetchStatement($stmt, $data);
ociFreeStatement($stmt);
} else die("Cannot parse SQL statement.");
ociCommit($conn);
ociLogoff($conn);
}
ociSelect($data);
if ($hitNo < MAX_REDIRECTS) {
header("Location: ".$SCRIPT_NAME."?hitNo=".$hitNo);
exit;
} else echo $hitNo." HTTP redirects passed ok.<br> <a
href='".$SCRIPT_NAME."'>Click to test it again.</a><br>";
?>
---------------------------------------------------------------------------
[2001-05-23 00:03:30] sniper@php.net
Can't reproduce. Please include short scripts and instructions how to reproduce this.
--Jani
---------------------------------------------------------------------------
[2001-05-21 14:54:12] peter.valkov@total-graphics.com
After form data is submitted to the script i have up to 3
header('Location: '.$newPage);
http redirects. In case i hit 3rd page where i have constant defined it is full with garbage !?!?!
define("CONSTANT","value");
if (CONSTANT != "value") die("Why is that?!?");
If i hit this page with same parameters but not from http redirect or using PHP 4.0.4pl1 everything
is woking fine.
I can not expose entire script here because is quite big (2000 lines +).
I'm using IE 5.5 SP1.
Linux Mandrake 7.2
PHP 4.0.5 compiled --with-apxs --with-mysql --with-oci8
using egcs-2.91.66
libc-5.3.12
glibc-2.1.3
apache 1.3.14
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10997&edit=2