php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7008 Virtual() does not work with Output Buffering
Submitted: 2000-10-04 03:35 UTC Modified: 2000-11-21 07:31 UTC
From: rich at todobebe dot com Assigned:
Status: Closed Package: Output Control
PHP Version: 4.0.2 OS: RedHat 6.2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rich at todobebe dot com
New email:
PHP Version: OS:

 

 [2000-10-04 03:35 UTC] rich at todobebe dot 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-21 07:31 UTC] stas@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 06:01:30 2024 UTC