#19678 [Bgs]: echo and print output the number of bytes written

From: Date: Mon, 30 Sep 2002 23:40:46 +0000
Subject: #19678 [Bgs]: echo and print output the number of bytes written
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-20823@lists.php.net to get a copy of this message
ID: 19678 User updated by: busby@pnts.com Reported By: busby@pnts.com Status: Bogus Bug Type: Output Control Operating System: redhat 7.3 PHP Version: 4.2.3 New Comment: I was wondering if there is an example of how to implement chunked output in PHP? Where do I tell PHP to use HTTP/1.1 or HTTP/1.0. Even if I was using HTTP/1.1 why don't my PHP scripts do this for all pages? This only happens on some pages (most notebly my SOAP processing scripts) and not on others (plain XHTML output). Previous Comments: ------------------------------------------------------------------------ [2002-09-30 16:18:33] hholzgra@php.net you just discovered http/1.1 chunked output encoding ;) you can either switch to http/1.0 to prevent chunked output or implement chunk decoding as required as a 'MUST' in RFC2616 see also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1 http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.4.6 ------------------------------------------------------------------------ [2002-09-30 14:11:05] busby@pnts.com $doc = domxml_open_mem($HTTP_RAW_POST_DATA); if (!$doc) { soap_fault("BAD_DATA","The content supplied was invalid"); } $env = $doc->document_element(); $body = $env->first_child(); $nodes = $body->child_nodes(); $c = sizeof($nodes); for($i=0;$i<$c;$i++) { if ($nodes[$i]->tagname == "method") $method = $nodes[$i]->get_content(); if ($nodes[$i]->tagname == "argv") $argv = $nodes[$i]->child_nodes(); } echo "AnyData Here"; results in: c AnyData Here That 'c' represents 12, the number of bytes written. It will do this for every usage of echo, here is a more complicated response result (can't show code cause my company won't allow that, will try to provide another sample later) Sample Code/Output: -- begin code -- header("Content-Type: text/xml; charset=\"UTF-8\")"); header("Cache-control: private"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>"; echo "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">"; echo "<SOAP-ENV:Body>"; echo "<status>success</status>"; echo "</SOAP-ENV:Body></SOAP-ENV:Envelope>"; exit(); -- end code -- -- begin output -- d0 <?xml version="1.0" encoding="UTF-8" standalone="no" ?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><status>success</status></SOAP-ENV:Body></SOAP-ENV:Envelope> 0 -- end output -- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19678&edit=1

« previous php.bugs (#20823) next »