php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18905 apache 2.0.40 changed template for register_*_filter adding additional arg
Submitted: 2002-08-14 10:43 UTC Modified: 2002-08-14 13:43 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: jon dot tankersley at eds dot com Assigned:
Status: Closed Package: Apache related
PHP Version: 4.2.2 OS: Solaris 2.8
Private report: No CVE-ID: None
 [2002-08-14 10:43 UTC] jon dot tankersley at eds dot com
From 4.2.2 sapi_apache2.c:
static void php_register_hook(apr_pool_t *p)
{
        ap_hook_post_config(php_apache_server_startup, NULL, NULL, APR_HOOK_MIDDLE);
        ap_hook_insert_filter(php_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
    ap_hook_post_read_request(php_post_read_request, NULL, NULL, APR_HOOK_MIDDLE);
        ap_register_output_filter("PHP", php_output_filter, AP_FTYPE_RESOURCE);
        ap_register_input_filter("PHP", php_input_filter, AP_FTYPE_RESOURCE);
}

From apache 2.0.39 include/util_filter.h:
 * @param name The name to attach to the filter function
 * @param filter_func The filter function to name
 * @param ftype The type of filter function, either ::AP_FTYPE_CONTENT or
 *              ::AP_FTYPE_CONNECTION
 * @see ap_add_output_filter()
 */
AP_DECLARE(ap_filter_rec_t *) ap_register_output_filter(const char *name,
                                            ap_out_filter_func filter_func,
                                            ap_filter_type ftype);

From apache 2.0.40 include/util_filter.h:
* @param name The name to attach to the filter function
 * @param filter_func The filter function to name
 * @param ftype The type of filter function, either ::AP_FTYPE_CONTENT or
 *              ::AP_FTYPE_CONNECTION
 * @see ap_add_output_filter()
 */
AP_DECLARE(ap_filter_rec_t *) ap_register_output_filter(const char *name,
                                            ap_out_filter_func filter_func,
                                            ap_init_filter_func filter_init,
                                            ap_filter_type ftype);

Similar problem with register_input_filter.

My config setup is as follows, with apache 2.0.40 installed in /usr/local/gnu/test
CC=gcc ./configure --verbose --prefix=/usr/local/gnu --with-zlib --with-bz2=/usr/local/gnu --with-jpeg-dir=/usr/local/gnu --with-tiff-dir=/usr/local/gnu --with-gdbm=/usr/local/gnu --with-gd=/usr/local/gnu --with-ttf=/usr/local/gnu --with-xpm-dir=/usr/local/gnu --with-png-dir=/usr/local/gnu --with-mysql=/usr/local/gnu --with-apxs2=/usr/local/gnu/test/bin/apxs --with-axps2=/usr/local/gnu/test/bin/apxs

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-14 10:45 UTC] php at james dot tavares dot name
I am experiencing this issue as well on Debian GNU/Linux 3.0.

I have compiled Apache 2.0.40 and attempting to compile php 4.2.2:
sapi_apache2.c: In function `php_register_hook':
sapi_apache2.c:534: warning: passing arg 3 of `ap_register_output_filter' makes pointer from integer without a cast
sapi_apache2.c:534: too few arguments to function `ap_register_output_filter'
sapi_apache2.c:535: warning: passing arg 3 of `ap_register_input_filter' makes pointer from integer without a cast
sapi_apache2.c:535: too few arguments to function `ap_register_input_filter'
 [2002-08-14 10:46 UTC] jon dot tankersley at eds dot com
typo in email address.
 [2002-08-14 10:46 UTC] sniper@php.net
Reclassified..

 [2002-08-14 11:42 UTC] sander@php.net
Someone already fixed that months ago ;)
 [2002-08-14 11:49 UTC] edink@php.net
Just to to clarify:

This bug has been fixed in CVS. You can grab a snapshot of the CVS version at http://snaps.php.net/.
 [2002-08-14 12:04 UTC] jon dot tankersley at eds dot com
Found reference in the Apache changes:

  *) Add a filter_init parameter to the filter registration
     functions so that a filter can execute arbitrary code
     before the handlers are invoked.  This resolves a
     problem where mod_include requests would incorrectly
     return a 304.  [Justin Erenkrantz]
 [2002-08-14 12:36 UTC] jon dot tankersley at eds dot com
It wasn't in the latest download from the php.net main site or easily found in the bugs database.

There may also be a problem with the 4.2.1-4.2.2 unified diff file.  That failed with a missing data at the end and I then went after the 4.2.2 full source tree.

Thanks for the quick turn around though.
 [2002-08-14 12:56 UTC] duke at mastre dot com
So the fix is..:  Either use the latest PHP non-STABLE snapshot (as of now, php4-200208140900), or use php4-STABLE-200208140900 and modify sapi/apache2filter/sapi_apache2.c and add NULL as parameter 3 for ap_register_*_filter (lines 567 & 568).
 [2002-08-14 13:43 UTC] jon dot tankersley at eds dot com
Adding a NULL as parameter 3 is okay..... but php_functions.c for some reason is using a deprecated macro.....
MODULE_MAGIC_AT_LEAST
I don't know if it was in 4.2.1, I blew that away last night.

The unstable might be a better bet.
 [2002-08-14 14:10 UTC] duke at mastre dot com
As far as I can tell that was fixed in the STABLE snapshot as well.  It used to be MODULE_MAGIC_AT_LEAST, with the fix being changing it to AP_MODULE_MAGIC_AT_LEAST (this is the case in 4.2.2-RELEASE).  sapi/apache2filter/php_functions.c from php4-STABLE-200208140900 no longer contains this code, only

#if MODULE_MAGIC_NUMBER < 20020506
        ADD_STRING(boundary);
#endif

This appears to be current (meaning: I did not get any complaints ;)  So stable should be fine after all.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC