File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -478,21 +478,21 @@ pub struct ExceptionGuard(PhantomData<*mut ()>);
478
478
479
479
impl Default for ExceptionGuard {
480
480
fn default ( ) -> Self {
481
- EXCEPTION_GUARD_COUNT . fetch_add ( 1 , atomic:: Ordering :: Acquire ) ;
482
- unsafe {
483
- zend_exception_save ( ) ;
481
+ if EXCEPTION_GUARD_COUNT . fetch_add ( 1 , atomic:: Ordering :: Acquire ) == 0 {
482
+ unsafe {
483
+ zend_exception_save ( ) ;
484
+ }
484
485
}
485
486
Self ( PhantomData )
486
487
}
487
488
}
488
489
489
490
impl Drop for ExceptionGuard {
490
491
fn drop ( & mut self ) {
491
- if EXCEPTION_GUARD_COUNT . fetch_sub ( 1 , atomic:: Ordering :: Acquire ) > 1 {
492
- return ;
493
- }
494
- unsafe {
495
- zend_exception_restore ( ) ;
492
+ if EXCEPTION_GUARD_COUNT . fetch_sub ( 1 , atomic:: Ordering :: Acquire ) == 1 {
493
+ unsafe {
494
+ zend_exception_restore ( ) ;
495
+ }
496
496
}
497
497
}
498
498
}
You can’t perform that action at this time.
0 commit comments