With a threaded MPM of httpd-2.0, the userdata wouldn't have its
state stored properly (it'd always be NULL).  Therefore, the
server would fail in odd ways later on.  tsrm_startup() would
never be called and would segfault in php_post_read_request when
it tried to acquire the NULL mutex.  

This changes it from a setn call to a set call - it'll copy
the 1 and 2 into the hash's pool-allocated memory.  The setn is
bogus because the storage space of the 1 and 2 aren't guaranteed
to be long-lived.  (Look at how mod_rewrite does it.)  -- justin

Index: sapi/apache2filter/sapi_apache2.c
===================================================================
RCS file: /repository/php4/sapi/apache2filter/sapi_apache2.c,v
retrieving revision 1.74
diff -u -r1.74 sapi_apache2.c
--- sapi/apache2filter/sapi_apache2.c   24 Apr 2002 00:55:38 -0000      1.74
+++ sapi/apache2filter/sapi_apache2.c   5 May 2002 10:26:25 -0000
@@ -454,15 +454,15 @@
         * prevents us from starting PHP until the second load. */
        apr_pool_userdata_get(&data, userdata_key, s->process->pool);
        if (data == NULL) {
-               apr_pool_userdata_setn((const void *)1, userdata_key,
-                                                          apr_pool_cleanup_null, 
s->process->pool);
+               apr_pool_userdata_set((const void *)1, userdata_key,
+                                                         apr_pool_cleanup_null, 
+s->process->pool);
                return OK;
        }
        else if (data == (const void *)2) {
                return OK;
        }
-       apr_pool_userdata_setn((const void *)2, userdata_key,
-                                                  apr_pool_cleanup_null, 
s->process->pool);
+       apr_pool_userdata_set((const void *)2, userdata_key,
+                                                 apr_pool_cleanup_null, 
+s->process->pool);
 
        /* Set up our overridden path. */
        if (apache2_php_ini_path_override) {


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to