php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19678 echo and print output the number of bytes written
Submitted: 2002-09-30 14:11 UTC Modified: 2002-09-30 19:08 UTC
From: busby at pnts dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.2.3 OS: redhat 7.3
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: busby at pnts dot com
New email:
PHP Version: OS:

 

 [2002-09-30 14:11 UTC] busby at pnts dot 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 --

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-30 16:18 UTC] 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 18:40 UTC] busby at pnts dot com
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).
 [2002-09-30 19:08 UTC] hholzgra@php.net
this is not a php issue 

the decision whether to chunk is taken by the web server 
based on whether the client claims to support http/1.1


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 22:01:28 2024 UTC