#37566 [Opn->Ana]: session_set_save_handler _write can't throw Exception.

From: Date: Tue, 23 May 2006 22:03:22 +0000
Subject: #37566 [Opn->Ana]: session_set_save_handler _write can't throw Exception.
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969373096@lists.php.net to get a copy of this message
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( "ƒZƒbƒVƒ‡ƒ“ƒf[ƒ^‚̐ݒè‚ÉŽ¸”s‚µ‚Ü‚µ‚½B<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

« previous php.doc (#969373096) next »