The attached patch fixes the problems when
you build session extension as shared and MM.
(--enable-session=shared --with-mm)
Also adds a list of registered save handlers
to the phpinfo() output.
Please test/review. It works fine here,
as shared and as static. Now the mm module is treated
like the other external handlers..
--Jani
? .libs
Index: config.m4
===================================================================
RCS file: /repository/php4/ext/session/config.m4,v
retrieving revision 1.18
diff -u -r1.18 config.m4
--- config.m4 4 May 2002 16:48:48 -0000 1.18
+++ config.m4 26 Jun 2002 17:39:59 -0000
@@ -8,6 +8,15 @@
PHP_ARG_ENABLE(session, whether to enable PHP sessions,
[ --disable-session Disable session support], yes)
+if test "$PHP_SESSION" != "no"; then
+ AC_CHECK_FUNCS(pread pwrite)
+ PHP_MISSING_PWRITE_DECL
+ PHP_MISSING_PREAD_DECL
+ PHP_NEW_EXTENSION(session, session.c mod_files.c mod_mm.c mod_user.c, $ext_shared)
+ PHP_SUBST(SESSION_SHARED_LIBADD)
+ AC_DEFINE(HAVE_PHP_SESSION,1,[ ])
+fi
+
if test "$PHP_MM" != "no"; then
for i in /usr/local /usr $PHP_MM; do
if test -f "$i/include/mm.h"; then
@@ -22,14 +31,4 @@
PHP_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/lib, SESSION_SHARED_LIBADD)
PHP_ADD_INCLUDE($MM_DIR/include)
AC_DEFINE(HAVE_LIBMM, 1, [Whether you have libmm])
- PHP_MODULE_PTR(phpext_ps_mm_ptr)
-fi
-
-if test "$PHP_SESSION" != "no"; then
- AC_CHECK_FUNCS(pread pwrite)
- PHP_MISSING_PWRITE_DECL
- PHP_MISSING_PREAD_DECL
- PHP_NEW_EXTENSION(session, session.c mod_files.c mod_mm.c mod_user.c, $ext_shared)
- PHP_SUBST(SESSION_SHARED_LIBADD)
- AC_DEFINE(HAVE_PHP_SESSION,1,[ ])
fi
Index: mod_mm.c
===================================================================
RCS file: /repository/php4/ext/session/mod_mm.c,v
retrieving revision 1.38
diff -u -r1.38 mod_mm.c
--- mod_mm.c 6 Mar 2002 12:25:01 -0000 1.38
+++ mod_mm.c 26 Jun 2002 17:40:00 -0000
@@ -423,17 +423,6 @@
return SUCCESS;
}
-zend_module_entry php_session_mm_module = {
- STANDARD_MODULE_HEADER,
- "session mm",
- NULL,
- PHP_MINIT(ps_mm), PHP_MSHUTDOWN(ps_mm),
- NULL, NULL,
- NULL,
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
#endif
/*
Index: mod_mm.h
===================================================================
RCS file: /repository/php4/ext/session/mod_mm.h,v
retrieving revision 1.6
diff -u -r1.6 mod_mm.h
--- mod_mm.h 28 Feb 2002 08:26:40 -0000 1.6
+++ mod_mm.h 26 Jun 2002 17:40:00 -0000
@@ -23,19 +23,13 @@
#include "php_session.h"
+PHP_MINIT_FUNCTION(ps_mm);
+PHP_MSHUTDOWN_FUNCTION(ps_mm);
+
extern ps_module ps_mod_mm;
#define ps_mm_ptr &ps_mod_mm
-extern zend_module_entry php_session_mm_module;
-#define phpext_ps_mm_ptr &php_session_mm_module
-
PS_FUNCS(mm);
-#else
-
-#define ps_mm_ptr NULL
-#define phpext_ps_mm_ptr NULL
-
#endif
-
#endif
Index: session.c
===================================================================
RCS file: /repository/php4/ext/session/session.c,v
retrieving revision 1.309
diff -u -r1.309 session.c
--- session.c 12 Jun 2002 08:18:36 -0000 1.309
+++ session.c 26 Jun 2002 17:40:01 -0000
@@ -50,6 +50,10 @@
#include "mod_files.h"
#include "mod_user.h"
+#ifdef HAVE_LIBMM
+#include "mod_mm.h"
+#endif
+
/* {{{ session_functions[]
*/
function_entry session_functions[] = {
@@ -1459,21 +1463,50 @@
zend_register_auto_global("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC);
PS(module_number) = module_number; /* if we really need this var we need to
init it in zts mode as well! */
+
REGISTER_INI_ENTRIES();
+
+#ifdef HAVE_LIBMM
+ PHP_MINIT(ps_mm) (INIT_FUNC_ARGS_PASSTHRU);
+#endif
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(session)
{
UNREGISTER_INI_ENTRIES();
+
+#ifdef HAVE_LIBMM
+ PHP_MSHUTDOWN(ps_mm) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
+#endif
+
return SUCCESS;
}
PHP_MINFO_FUNCTION(session)
{
+ ps_module **mod;
+ smart_str handlers = {0};
+ int i;
+
+ for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++) {
+ if (*mod && (*mod)->name) {
+ smart_str_appends(&handlers, (*mod)->name);
+ smart_str_appendc(&handlers, ' ');
+ }
+ }
+
php_info_print_table_start();
php_info_print_table_row(2, "Session Support", "enabled" );
+
+ if (handlers.c) {
+ smart_str_0(&handlers);
+ php_info_print_table_row(2, "Registered save handlers", handlers.c);
+ smart_str_free(&handlers);
+ } else {
+ php_info_print_table_row(2, "Registered save handlers", "none");
+ }
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php