Skip to content

Commit da3660a

Browse files
committed
Fixed bug (segfault due to PS(mod_user_implemented) not be reseted when closing handler call exit)
1 parent 49e9115 commit da3660a

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ PHP NEWS
2121
. Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong
2222
result). (Laruence)
2323

24+
- Session:
25+
. Fixed bug (segfault due to PS(mod_user_implemented) not be reseted
26+
when close handler call exit). (Laruence)
27+
28+
2429
?? ??? 2012, PHP 5.4.6
2530

2631
- CLI Server:

ext/session/mod_user.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,30 @@ PS_OPEN_FUNC(user)
9999

100100
PS_CLOSE_FUNC(user)
101101
{
102+
zend_bool bailout = 0;
102103
STDVARS;
103104

104105
if (!PS(mod_user_implemented)) {
105106
/* already closed */
106107
return SUCCESS;
107108
}
108109

109-
retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
110+
zend_try {
111+
retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
112+
} zend_catch {
113+
bailout = 1;
114+
PS(mod_user_implemented) = 0;
115+
} zend_end_try();
116+
110117
PS(mod_user_implemented) = 0;
111118

119+
if (bailout) {
120+
if (retval) {
121+
zval_ptr_dtor(&retval);
122+
}
123+
zend_bailout();
124+
}
125+
112126
FINISH;
113127
}
114128

0 commit comments

Comments
 (0)