# [PATCH] Repost - Adding Output Filters w/ Apache2 Handler SAPI

- Thread: https://externals.io/message/9559
- Original archive: https://news-web.php.net/php.internals/9559
- Started by Paul Querna on 2004-04-26T02:13:56+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #9559 — Paul Querna — 2004-04-26T02:13:56+00:00

URL: https://externals.io/message/9559#9559

I added two new functions for handling output filters in the
Apache2Handler SAPI:

bool apache_add_output_filter(string filter_name) - Attempts to add the
named filter to the Filter Chain.

array apache_get_output_filters() - Returns an array of all Active
Output filters for this request

The ability to add an output filter is very helpful in the apache
2model.  For example with this I was able to add an XSLT output filter
that I use in other areas to render XML generated from PHP to HTML.

The attached patches are for both PHP4 CVS and PHP5 CVS. They are also
online at: http://force-elite.com/~chip/patches/php-src/apache2-filters/

I posted this patches last Monday, but received 0 replies.  Are the
patches acceptable, is there anything to change, or are there any
comments?

Thanks,

-Paul Querna

---

## #9564 — Andi Gutmans — 2004-04-26T08:33:48+00:00

URL: https://externals.io/message/9559#9564 · In reply to: #9559

Can you please give an example on how this can be used?

At 08:13 PM 4/25/2004 -0600, Paul Querna wrote:
>I added two new functions for handling output filters in the
>Apache2Handler SAPI:
>
>bool apache_add_output_filter(string filter_name) - Attempts to add the
>named filter to the Filter Chain.
>
>array apache_get_output_filters() - Returns an array of all Active
>Output filters for this request
>
>The ability to add an output filter is very helpful in the apache
>2model.  For example with this I was able to add an XSLT output filter
>that I use in other areas to render XML generated from PHP to HTML.
>
>The attached patches are for both PHP4 CVS and PHP5 CVS. They are also
>online at: http://force-elite.com/~chip/patches/php-src/apache2-filters/
>
>I posted this patches last Monday, but received 0 replies.  Are the
>patches acceptable, is there anything to change, or are there any
>comments?
>
>Thanks,
>
>-Paul Querna

---

## #9615 — Edward Rudd — 2004-04-30T01:31:04+00:00

URL: https://externals.io/message/9559#9615 · In reply to: #9564

Woohoo!
This is an awesome patch..
I hope it gets accepted into PHP proper.



> Can you please give an example on how this can be used?
> 

I am using it in a PHP web app I am writing where I am generating XML
output and running it through an XML filter via XSLT (mod_transform).  And
I can then selectively turn the filter on and off.. IE for XML data that I
don't want transformed, or for non-xml data. 

> At 08:13 PM 4/25/2004 -0600, Paul Querna wrote:
> > […]

---

## #9616 — Jevon Wright — 2004-04-30T02:53:21+00:00

URL: https://externals.io/message/9559#9616 · In reply to: #9615

What if you extended this to cover PHP in general - you could make your PHP
always generate XML data and then with add_output_filter(proprietary string
or callback function) you could make PHP transform the output at the end of
the script execution (possibly multiple times). I know a lot of developers
which are interested in a script -> xml -> xml -> xml -> xhtml pipeline, and
something like add_output_filter() might be a godsend :)

Yeah, I know it can be done in userland (somewhat)...

Jevon

----- Original Message ----- 
From: "Edward Rudd" <eddie@omegaware.com>
To: <internals@lists.php.net>
Sent: Friday, April 30, 2004 1:31 PM
Subject: Re: [PHP-DEV] [PATCH] Repost - Adding Output Filters w/ Apache2
Handler SAPI


> Woohoo!
> This is an awesome patch..
> I hope it gets accepted into PHP proper.
>
> 
>
> > […]
>
> I am using it in a PHP web app I am writing where I am generating XML
> output and running it through an XML filter via XSLT (mod_transform).  And
> I can then selectively turn the filter on and off.. IE for XML data that I
> don't want transformed, or for non-xml data.
>
> > […]
