php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36525 ob_gzhandler - issue
Submitted: 2006-02-25 10:22 UTC Modified: 2006-02-25 22:16 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: lunter at interia dot pl Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.1.2 OS: winXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lunter at interia dot pl
New email:
PHP Version: OS:

 

 [2006-02-25 10:22 UTC] lunter at interia dot pl
Description:
------------
ob_gzhandler does't return $i parametr when browser does't support gzip/deflate compression

Reproduce code:
---------------
<?
 function a($i,$m){
  $i=strtolower($i);
  $i=ob_gzhandler($i,$m);
  return($i);
 }
 ob_start('a');
?>
PAGE CONTENTS

Expected result:
----------------
send buffer in lower case

Actual result:
--------------
send buffer in UPPER case when browser does't support gzip/deflate compression

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-25 16:10 UTC] mike@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2006-02-25 20:10 UTC] lunter at interia dot pl
mike, do you know why function a return lower case string when browser does't support gzip/deflate compression ???
 [2006-02-25 20:28 UTC] mike@php.net
Because you call strtolower() on the string. The "a" output buffer handler is run without regard whether browser supports gzip content encoding.

 [2006-02-25 21:05 UTC] lunter at interia dot pl
hmm, this is for me odd, becouse to ob_gzhandler input is put strlower'ed string and:

output string ob_gzhandler ( input string )

1. when browser support gzip/deflate compression, ob_gzhandler return compressed input and send headers - this is ok.
2. when browser does't support gzip/deflate compression,
ob_gzhandler should return input string wihtout compression...
But it return different string to input string! Why ??

Mike, what is wrong in my reason ?
 [2006-02-25 22:02 UTC] lunter at interia dot pl
OK, I solved the proble. Corrent script:

<?
 function a($i,$m){
  $i=strtolower($i);
  $m=ob_gzhandler($i,$m);
  if($m!==false){$i=$m;}
  return($i);
 }
 ob_start('a');
?>
PAGE CONTENTS


But there are two issues with documentation:

1. http://php.net/manual/en/function.ob-gzhandler.php
There is not written what ob-gzhandler return boolean false if browser does't support gzip/deflate compression.
Without this sentence you may think that ob-gzhandler return uncompressed input string.
2. http://php.net/manual/en/function.ob-start.php
There is not written what if ob_start output_callback is a callable function and this function return boolean false, ob_start return original buffer.
 [2006-02-25 22:16 UTC] lunter at interia dot pl
/Edit/

1. ...
Without this sentence you may think that ob-gzhandler return (not compressed) input string.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 20:01:30 2025 UTC