PHP 4.0 Bug #7008 Updated: Virtual() does not work with Output Buffering

From: Date: Tue, 21 Nov 2000 12:31:23 +0000
Subject: PHP 4.0 Bug #7008 Updated: Virtual() does not work with Output Buffering
Groups: php.dev 
Request: Send a blank email to php-dev+get-38809@lists.php.net to get a copy of this message
ID: 7008 Updated by: stas Reported By: rich@todobebe.com Status: Closed Bug Type: Output Control Assigned To: Comments: This is because virtual actually calls another Apache handler which executes another sub-request, outside of the PHP process. Meaning, you cannot use OB mechanism with virtual, because when Apache executes virtual(), it know nothing on OB mechanism - in fact, it knows nothing about PHP that run it either. So you better use include() in this case. It's also more portable. Previous Comments: --------------------------------------------------------------------------- [2000-10-04 03:35:22] rich@todobebe.com I'm using apache 1.3.12. Configure Line ( from phpinfo() ): ./configure' '--with-gd=/usr/local' '--with-jpeg-dir=/usr/local' '--with-ttf=/usr/local' '--with-apxs=/www/bin/apxs' '--with-mysql=/usr/local/mysql' '--enable-sysvsem' '--enable-sysvshm' '--with-zlib' '--disable-debug' '--enable-inline-optimization' '--enable-wddx' '--enable-sockets' '--with-mm' The bit of code that does it on my setup: <?php ob_start(); virtual( $HTTP_SERVER_VARS['PATH_INFO'] . '?' . $QUERY_STRING ); $content = ob_get_contents(); ob_end_clean(); ?> The code in the virtual() call should obviously be replaced with something relevant on your setup. When virtual is called, the output is immediately sent to the browser and not assigned to $content . I have a virtually identical script using an include() instead of virtual() and it works perfectly. --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7008

« previous php.dev (#38809) next »