php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23231 Memory cannot written
Submitted: 2003-04-15 21:01 UTC Modified: 2003-05-09 19:13 UTC
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:0 of 0 (0.0%)
From: xswang2000 at 163 dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.3.2-RC OS: win2000server
Private report: No CVE-ID: None
 [2003-04-15 21:01 UTC] xswang2000 at 163 dot com
I have custom the session handle function using "session_set_save_handler()"(use oracle8i save session data),when I input string into variable,the system popup error message : 
   php.exe :application error: "0x77fcb7ae" ... this memory cannot written .

thanks .

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-21 12:38 UTC] 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.


.
 [2003-04-21 19:36 UTC] 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-24 08:23 UTC] 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-28 10:25 UTC] sniper@php.net
Are you sure you have it updated? What does phpinfo() say about PHP version?

 [2003-04-28 10:26 UTC] sniper@php.net
And provide a full example script. And if possible, NOT using  
oracle, but something that everyone has..

 [2003-04-30 06:19 UTC] sniper@php.net
Does it only happen when you use oracle within your
save handler stuff? What if you use filesystem funcs instead?

 [2003-05-09 07:33 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-05-09 19:13 UTC] xswang2000 at 163 dot com
I had use mysql to save sessions data , it's normally ,thank your attention!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 17:01:33 2024 UTC