For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > May 2006 > #37566 [Opn->Ana]: session_set_save_handler _write can't throw Exception.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #37566 [Opn->Ana]: session_set_save_handler _write can't throw Exception.
bjori@php.net

2006-05-23, 6:59 pm

ID: 37566
Updated by: bjori@php.net
Reported By: kotsutsumi at xenophy dot com
-Status: Open
+Status: Analyzed
-Bug Type: *General Issues
+Bug Type: Documentation problem
-Operating System: FedoraCore5
+Operating System: *
-PHP Version: 5.1.4
+PHP Version: *
New Comment:

Reclassified as documentation problem.

session_write_close() (write and close) is called during
the script shutdown and can't therefor throw exceptions.


Previous Comments:
------------------------------------------------------------------------

[2006-05-23 21:49:05] kotsutsumi at xenophy dot com

Description:
------------
It mounts in the class.

session_set_save_handler(
array($this, '_open'),
array($this, '_close'),
array($this, '_read'),
array($this, '_write'),
array($this, '_destroy'),
array($this, '_clean')
);

....

public function _write( $strID, &$objData ) {

// some process.
throw new Exception;
}

Result:
Exception thrown without a stack frame in ....

Why?
The exception is normally generated in other methods.
ex. _read,_destroy,_clear...

Reproduce code:
---------------
public function _write( $strID, &$objData ) {

try {
$strSQL = "REPLACE INTOd sessions hogeVALUES ( ?, ?, ?
)";

$putData = $this->objResource->prepare( $strSQL );
$putData->bindParam( 1, $strID );
$putData->bindParam( 2, time() );
$putData->bindParam( 3, $objData );
$putData->execute();
return true;
} catch( PDOException $e) {
$strError = sprintf(
"セッションデータの設定に失敗しました。<br><br>%s" ,$e->getMessage()
);
throw new Exception( $strError );
}
}

Expected result:
----------------
Fatal error: Exception thrown without a stack frame in Unknown on line
0



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=37566&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com