#23231 [Fbk]: Memory cannot written
| From: | sniper@php.net | Date: | Mon, 28 Apr 2003 15:26:37 +0000 |
| Subject: | #23231 [Fbk]: Memory cannot written | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-38588@lists.php.net to get a copy of this message | ||
ID: 23231
Updated by: sniper@php.net
Reported By: xswang2000 at 163 dot com
Status: Feedback
Bug Type: Session related
Operating System: win2000server
PHP Version: 4.3.2-RC
New Comment:
And provide a full example script. And if possible, NOT using
oracle, but something that everyone has..
Previous Comments:
------------------------------------------------------------------------
[2003-04-28 10:25:09] sniper@php.net
Are you sure you have it updated? What does phpinfo() say about PHP
version?
------------------------------------------------------------------------
[2003-04-24 08:23:59] xswang2000 at 163 dot com
After upgrade php from
"http://snaps.php.net/win32/php4-win32-STABLE-latest.zip",but
this
problem is still exists , thanks .
------------------------------------------------------------------------
[2003-04-23 03:19:17] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2003-04-21 19:36:18] xswang2000 at 163 dot com
can not use "session_set_save_handler()" save session data to oracle8i
database ,the system always popup error message :php.exe :application
error: "0x77fcb7ae" ... this memory cannot written .
Source Code (File Name:session_oracle.php):
<?
$SESS_DBH = "";
$SESS_LIFE = get_cfg_var("session.gc_maxlifetime");
function sess_open($save_path, $session_name) {
//global $SESS_DBHOST, $SESS_DBNAME, $SESS_DBUSER, $SESS_DBPASS,
$SESS_DBH;
global $SESS_DBH ;
$SESS_DBH = connection() ;
return true;
}
function sess_close() {
return true;
}
function sess_read($key) {
global $SESS_DBH, $SESS_LIFE;
$qry_r = "SELECT value FROM sessions WHERE sesskey = '$key' AND expiry
> " . time();
echo $qry_r ;
$stmt_r = OCIParse($SESS_DBH,$qry_r) ;
OCIdefinebyname($stmt_r,"VALUE",$value) ;
OCIExecute($stmt_r) ;
//if (list($value) = OCIFetch($stmt_r)) {
//if (list($value) = OCIFetchInto($stmt_r, $row, OCI_ASSOC)) {
while (ocifetch($stmt_r)) {
// echo "<BR>Value :".$value."<BR>" ;
return $value;
}
OCIFreeStatement($stmt_r) ;
return false ;
}
function sess_write($key, $val) {
global $SESS_DBH, $SESS_LIFE;
$expiry = time() + $SESS_LIFE;
$value = addslashes($val);
$qry_i = " INSERT INTO sessions VALUES ('".$key."', ".$expiry.",
'".$value."') ";
$stmt_i = OCIParse($SESS_DBH,$qry_i) ;
$qid_i = @OCIExecute($stmt_i) ;
OCICommit($SESS_DBH);
if (! $qid_i ) {
$qry_u = "UPDATE sessions SET expiry = ".$expiry.", value =
'".$value."' WHERE sesskey = '".$key."' AND expiry >
" . time();
//echo $qry_u."<BR>" ;
$stmt_u = OCIParse($SESS_DBH,$qry_u) ;
$qid_u = OCIExecute($stmt_u) ;
OCICommit($SESS_DBH);
OCIFreeStatement($stmt_u) ;
}
OCIFreeStatement($stmt_i) ;
return $qid_i;
}
function sess_destroy($key) {
global $SESS_DBH;
$qry_d = "DELETE FROM sessions WHERE sesskey = '$key'";
$stmt_d = OCIParse($SESS_DBH,$qry_d) ;
$qid = OCIExecute($stmt_d) ;
OCICommit($SESS_DBH);
OCIFreeStatement($stmt_d) ;
return $qid;
}
function sess_gc($maxlifetime) {
global $SESS_DBH;
$qry = "DELETE FROM sessions WHERE expiry < " . time();
$stmt = OCIParse($SESS_DBH,$qry) ;
$qid = OCIExecute($stmt) ;
OCICommit($SESS_DBH);
$rec_count = OCIRowCount($stmt) ;
OCIFreeStatement($stmt) ;
return $rec_count ;
}
session_set_save_handler(
"sess_open",
"sess_close",
"sess_read",
"sess_write",
"sess_destroy",
"sess_gc");
?>
------------------------------------------------------------------------
[2003-04-21 12:38:27] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23231
--
Edit this bug report at http://bugs.php.net/?id=23231&edit=1