Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/session mod_user.c mod_user.h php_session.h session.c

2008-04-24 Thread Antony Dovgal

On 08.03.2008 02:20, Gwynne Raskind wrote:

gwynne  Fri Mar  7 23:20:32 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/session	mod_user.c mod_user.h php_session.h session.c 
  Log:

  MFH: fix bug #32330 (session_destroy, Failed to initialize storage module, 
custom session handler)


Gwynne, what about 5_2?

It still leaks memory:

# cat /local/qa/5_2/ext/session/tests/session_set_save_handler_error4.diff
012+ [Thu Apr 24 02:05:35 2008]  Script:  
'/local/qa/5_2/ext/session/tests/session_set_save_handler_error4.php'
013+ /local/qa/5_2/Zend/zend_vm_execute.h(1805) :  Freeing 0x0108F0F0 (24 
bytes), 
script=/local/qa/5_2/ext/session/tests/session_set_save_handler_error4.php
014+ Last leak repeated 5 times
015+ [Thu Apr 24 02:05:35 2008]  Script:  
'/local/qa/5_2/ext/session/tests/session_set_save_handler_error4.php'
016+ /local/qa/5_2/Zend/zend_variables.h(45) :  Freeing 0x01091DA8 (9 bytes), 
script=/local/qa/5_2/ext/session/tests/session_set_save_handler_error4.php
017+ /local/qa/5_2/Zend/zend_variables.c(120) : Actual location (location was 
relayed)
018+ Last leak repeated 5 times
019+ [Thu Apr 24 02:05:35 2008]  Script:  
'/local/qa/5_2/ext/session/tests/session_set_save_handler_error4.php'
020+ /local/qa/5_2/ext/session/session.c(1512) :  Freeing 0x01093A48 (48 
bytes), 
script=/local/qa/5_2/ext/session/tests/session_set_save_handler_error4.php
021+ === Total 13 memory leaks detected ===

--
Wbr, 
Antony Dovgal


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/session mod_user.c mod_user.h php_session.h session.c

2008-03-07 Thread Gwynne Raskind
gwynne  Fri Mar  7 23:20:32 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/sessionmod_user.c mod_user.h php_session.h session.c 
  Log:
  MFH: fix bug #32330 (session_destroy, Failed to initialize storage module, 
custom session handler)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/session/mod_user.c?r1=1.29.2.1.2.1.2.1r2=1.29.2.1.2.1.2.2diff_format=u
Index: php-src/ext/session/mod_user.c
diff -u php-src/ext/session/mod_user.c:1.29.2.1.2.1.2.1 
php-src/ext/session/mod_user.c:1.29.2.1.2.1.2.2
--- php-src/ext/session/mod_user.c:1.29.2.1.2.1.2.1 Mon Dec 31 07:17:13 2007
+++ php-src/ext/session/mod_user.c  Fri Mar  7 23:20:32 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: mod_user.c,v 1.29.2.1.2.1.2.1 2007/12/31 07:17:13 sebastian Exp $ */
+/* $Id: mod_user.c,v 1.29.2.1.2.1.2.2 2008/03/07 23:20:32 gwynne Exp $ */
 
 #include php.h
 #include php_session.h
@@ -70,14 +70,17 @@
return retval;
 }
 
-#define STDVARS\
+#define STDVARS1   \
zval *retval;   \
-   int ret = FAILURE;  \
-   ps_user *mdata = PS_GET_MOD_DATA(); \
+   int ret = FAILURE
+
+#define STDVARS
\
+   STDVARS1;   
\
+   char *mdata = PS_GET_MOD_DATA();\
if (!mdata) \
return FAILURE
 
-#define PSF(a) mdata-name.ps_##a
+#define PSF(a) PS(mod_user_names).name.ps_##a
 
 #define FINISH 
\
if (retval) {   \
@@ -90,27 +93,32 @@
 PS_OPEN_FUNC(user)
 {
zval *args[2];
-   STDVARS;
+   static char dummy = 0;
+   STDVARS1;

SESS_ZVAL_STRING(save_path, args[0]);
SESS_ZVAL_STRING(session_name, args[1]);

retval = ps_call_handler(PSF(open), 2, args TSRMLS_CC);
+   if (retval) {
+   /* This is necessary to fool the session module. Yes, it's safe 
to
+* use a static. Neither mod_user nor the session module itself 
will
+* ever touch this pointer. It could be set to 0xDEADBEEF for 
all the
+* difference it makes, but for the sake of paranoia it's set 
to some
+* valid value.
+   */
+   PS_SET_MOD_DATA(dummy);
+   }

FINISH;
 }
 
 PS_CLOSE_FUNC(user)
 {
-   int i;
-   STDVARS;
+   STDVARS1;
 
retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
 
-   for (i = 0; i  6; i++)
-   zval_ptr_dtor(mdata-names[i]);
-   efree(mdata);
-
PS_SET_MOD_DATA(NULL);
 
FINISH;
http://cvs.php.net/viewvc.cgi/php-src/ext/session/mod_user.h?r1=1.14.2.1.2.1.2.1r2=1.14.2.1.2.1.2.2diff_format=u
Index: php-src/ext/session/mod_user.h
diff -u php-src/ext/session/mod_user.h:1.14.2.1.2.1.2.1 
php-src/ext/session/mod_user.h:1.14.2.1.2.1.2.2
--- php-src/ext/session/mod_user.h:1.14.2.1.2.1.2.1 Mon Dec 31 07:17:13 2007
+++ php-src/ext/session/mod_user.h  Fri Mar  7 23:20:32 2008
@@ -16,23 +16,11 @@
+--+
  */
 
-/* $Id: mod_user.h,v 1.14.2.1.2.1.2.1 2007/12/31 07:17:13 sebastian Exp $ */
+/* $Id: mod_user.h,v 1.14.2.1.2.1.2.2 2008/03/07 23:20:32 gwynne Exp $ */
 
 #ifndef MOD_USER_H
 #define MOD_USER_H
 
-typedef union {
-   zval *names[6];
-   struct {
-   zval *ps_open;
-   zval *ps_close;
-   zval *ps_read;
-   zval *ps_write;
-   zval *ps_destroy;
-   zval *ps_gc;
-   } name;
-} ps_user;
-
 extern ps_module ps_mod_user;
 #define ps_user_ptr ps_mod_user
 
http://cvs.php.net/viewvc.cgi/php-src/ext/session/php_session.h?r1=1.101.2.2.2.5.2.1r2=1.101.2.2.2.5.2.2diff_format=u
Index: php-src/ext/session/php_session.h
diff -u php-src/ext/session/php_session.h:1.101.2.2.2.5.2.1 
php-src/ext/session/php_session.h:1.101.2.2.2.5.2.2
--- php-src/ext/session/php_session.h:1.101.2.2.2.5.2.1 Mon Dec 31 07:17:13 2007
+++ php-src/ext/session/php_session.h   Fri Mar  7 23:20:32 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_session.h,v 1.101.2.2.2.5.2.1 2007/12/31 07:17:13 sebastian Exp $ 
*/
+/* $Id: php_session.h,v 1.101.2.2.2.5.2.2 2008/03/07 23:20:32 gwynne Exp $ */
 
 #ifndef PHP_SESSION_H
 #define PHP_SESSION_H
@@ -112,6 +112,17 @@
long gc_maxlifetime;
int module_number;
long cache_expire;
+   union {
+