Bug #72265 [NEW]: session exception

From: Date: Thu, 26 May 2016 02:37:33 +0000
Subject: Bug #72265 [NEW]: session exception
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201275@lists.php.net to get a copy of this message
From: wangyuan at lianlife dot com Operating system: linux 5.4 x64 PHP version: 5.6.21 Package: Session related Bug Type: Bug Bug description:session exception Description: ------------ I can't catch the exception that is thrown from the write method in the sess class, but other methods can work properly, such as open (), read () and other. I'm not sure PHP itself is designed, or is it a bug. Run result in the console : Test script: --------------- class sess extends SessionHandler { public function read($session_id) { throw new Exception('read'); } public function write($session_id, $session_data) { throw new Exception('write'); } } try { $handler = new sess(); session_set_save_handler($handler, true); session_start(); $_SESSION['name'] = 'php'; $_SESSION['gender'] = 'female'; echo $_SESSION['name']; } catch (Exception $e) { echo '<pre>'; print_r($e); echo '</pre>'; } Expected result: ---------------- The following information should be catch, but it is displayed as "excetpion Uncaught" 2016/05/26 10:17:37 [error] 13474#0: *19551 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'Exception' with message '0jib891huoct6e4lpl5i3f9tt7name|s:8:"wangyuan";gender|s:4:"male";' in /data/web/ndl/test.php:11 Stack trace: #0 [internal function]: sess->write('0jib891huoct6e4...', 'name|s:8:"wangy...') #1 [internal function]: session_write_close() #2 {main} thrown in /data/web/ndl/test.php on line 11" while reading response header from upstream, client: 10.24.18.243, server: ndl.lianlife.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "10.20.33.33:81" -- Edit bug report at https://bugs.php.net/bug.php?id=72265&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72265&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72265&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72265&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72265&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72265&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72265&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72265&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72265&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72265&r=support Expected behavior: https://bugs.php.net/fix.php?id=72265&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72265&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72265&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72265&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72265&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72265&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72265&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72265&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72265&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72265&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72265&r=mysqlcfg

« previous php.bugs (#201275) next »