@@ -160,7 +160,9 @@ PHPAPI int php_session_destroy(void) /* {{{ */
160
160
161
161
if (PS (id ) && PS (mod )-> s_destroy (& PS (mod_data ), PS (id )) == FAILURE ) {
162
162
retval = FAILURE ;
163
- php_error_docref (NULL , E_WARNING , "Session object destruction failed" );
163
+ if (!EG (exception )) {
164
+ php_error_docref (NULL , E_WARNING , "Session object destruction failed" );
165
+ }
164
166
}
165
167
166
168
php_rshutdown_session_globals ();
@@ -393,7 +395,9 @@ static int php_session_initialize(void) /* {{{ */
393
395
/* || PS(mod_data) == NULL */ /* FIXME: open must set valid PS(mod_data) with success */
394
396
) {
395
397
php_session_abort ();
396
- php_error_docref (NULL , E_WARNING , "Failed to initialize storage module: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
398
+ if (!EG (exception )) {
399
+ php_error_docref (NULL , E_WARNING , "Failed to initialize storage module: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
400
+ }
397
401
return FAILURE ;
398
402
}
399
403
@@ -405,14 +409,17 @@ static int php_session_initialize(void) /* {{{ */
405
409
PS (id ) = PS (mod )-> s_create_sid (& PS (mod_data ));
406
410
if (!PS (id )) {
407
411
php_session_abort ();
408
- zend_throw_error (NULL , "Failed to create session ID: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
412
+ if (!EG (exception )) {
413
+ zend_throw_error (NULL , "Failed to create session ID: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
414
+ }
409
415
return FAILURE ;
410
416
}
411
417
if (PS (use_cookies )) {
412
418
PS (send_cookie ) = 1 ;
413
419
}
414
420
} else if (PS (use_strict_mode ) && PS (mod )-> s_validate_sid &&
415
- PS (mod )-> s_validate_sid (& PS (mod_data ), PS (id )) == FAILURE ) {
421
+ PS (mod )-> s_validate_sid (& PS (mod_data ), PS (id )) == FAILURE
422
+ ) {
416
423
if (PS (id )) {
417
424
zend_string_release_ex (PS (id ), 0 );
418
425
}
@@ -435,7 +442,9 @@ static int php_session_initialize(void) /* {{{ */
435
442
if (PS (mod )-> s_read (& PS (mod_data ), PS (id ), & val , PS (gc_maxlifetime )) == FAILURE ) {
436
443
php_session_abort ();
437
444
/* FYI: Some broken save handlers return FAILURE for non-existent session ID, this is incorrect */
438
- php_error_docref (NULL , E_WARNING , "Failed to read session data: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
445
+ if (!EG (exception )) {
446
+ php_error_docref (NULL , E_WARNING , "Failed to read session data: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
447
+ }
439
448
return FAILURE ;
440
449
}
441
450
@@ -2186,7 +2195,9 @@ PHP_FUNCTION(session_regenerate_id)
2186
2195
if (PS (mod )-> s_destroy (& PS (mod_data ), PS (id )) == FAILURE ) {
2187
2196
PS (mod )-> s_close (& PS (mod_data ));
2188
2197
PS (session_status ) = php_session_none ;
2189
- php_error_docref (NULL , E_WARNING , "Session object destruction failed. ID: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2198
+ if (!EG (exception )) {
2199
+ php_error_docref (NULL , E_WARNING , "Session object destruction failed. ID: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2200
+ }
2190
2201
RETURN_FALSE ;
2191
2202
}
2192
2203
} else {
@@ -2217,14 +2228,18 @@ PHP_FUNCTION(session_regenerate_id)
2217
2228
2218
2229
if (PS (mod )-> s_open (& PS (mod_data ), PS (save_path ), PS (session_name )) == FAILURE ) {
2219
2230
PS (session_status ) = php_session_none ;
2220
- zend_throw_error (NULL , "Failed to open session: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2231
+ if (!EG (exception )) {
2232
+ zend_throw_error (NULL , "Failed to open session: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2233
+ }
2221
2234
RETURN_THROWS ();
2222
2235
}
2223
2236
2224
2237
PS (id ) = PS (mod )-> s_create_sid (& PS (mod_data ));
2225
2238
if (!PS (id )) {
2226
2239
PS (session_status ) = php_session_none ;
2227
- zend_throw_error (NULL , "Failed to create new session ID: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2240
+ if (!EG (exception )) {
2241
+ zend_throw_error (NULL , "Failed to create new session ID: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2242
+ }
2228
2243
RETURN_THROWS ();
2229
2244
}
2230
2245
if (PS (use_strict_mode ) && PS (mod )-> s_validate_sid &&
@@ -2234,15 +2249,19 @@ PHP_FUNCTION(session_regenerate_id)
2234
2249
if (!PS (id )) {
2235
2250
PS (mod )-> s_close (& PS (mod_data ));
2236
2251
PS (session_status ) = php_session_none ;
2237
- zend_throw_error (NULL , "Failed to create session ID by collision: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2252
+ if (!EG (exception )) {
2253
+ zend_throw_error (NULL , "Failed to create session ID by collision: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2254
+ }
2238
2255
RETURN_THROWS ();
2239
2256
}
2240
2257
}
2241
2258
/* Read is required to make new session data at this point. */
2242
2259
if (PS (mod )-> s_read (& PS (mod_data ), PS (id ), & data , PS (gc_maxlifetime )) == FAILURE ) {
2243
2260
PS (mod )-> s_close (& PS (mod_data ));
2244
2261
PS (session_status ) = php_session_none ;
2245
- zend_throw_error (NULL , "Failed to create(read) session ID: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2262
+ if (!EG (exception )) {
2263
+ zend_throw_error (NULL , "Failed to create(read) session ID: %s (path: %s)" , PS (mod )-> s_name , PS (save_path ));
2264
+ }
2246
2265
RETURN_THROWS ();
2247
2266
}
2248
2267
if (data ) {
0 commit comments