[PHP-BUG] Bug #65115 [NEW]: flush() disables compression from ob_gzhandler
From: preinheimer Operating system: linux PHP version: 5.4.16 Package: Output Control Bug Type: Bug Bug description:flush() disables compression from ob_gzhandler Description: Hi, Consider the test script. One might expect to see: Content-Encoding: gzip in the response headers, but it's not there. If however you comment out that flush() compression is applied. As a small amount of background, I work on two tools that help display data from the xhprof extension. They both include flush(); ignore_user_abort(); before doing work to store the profiling information in attempt to have as little impact on the user as possible. Clearly flush() wasn't the safe command I thought it was, as it's having a large affect on the application I'm profiling. I'm prepared to write this up in the documentation, but I don't really think this is expected behavior. Test script: --- https://bugs.php.net/bug.php?id=65115&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65115&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65115&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65115&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65115&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65115&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65115&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65115&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65115&r=oldversion Not developer issue:https://bugs.php.net/fix.php?id=65115&r=support Expected behavior: https://bugs.php.net/fix.php?id=65115&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65115&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65115&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65115&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65115&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65115&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65115&r=isapi Install GNU Sed:https://bugs.php.net/fix.php?id=65115&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65115&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65115&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65115&r=mysqlcfg
Bug #65115 [Com]: flush() disables compression from ob_gzhandler
Edit report at https://bugs.php.net/bug.php?id=65115&edit=1 ID: 65115 Comment by: [email protected] Reported by:[email protected] Summary:flush() disables compression from ob_gzhandler Status: Not a bug Type: Bug Package:Output Control Operating System: linux PHP Version:5.4.16 Assigned To:mike Block user comment: N Private report: N New Comment: So if I run: http://test.local/obtest.php It looks (to me) like the entire output is compressed. The difference in behavior seems, well, necessary to allow the end agent to actually be able to read the output. But confusing from a "different output depending on what happened earlier" standpoint. Previous Comments: [2013-06-25 05:30:36] [email protected] Actually, this is debatable. Flush flushes the SAPI's I/O layer and we just note that output has irreversibly sent. If you want to flush the output buffering layer you have to use ob_flush prior flush. [2013-06-25 04:32:20] [email protected] I encountered this problem too. a workaround is don't use php's gzip handler, use the webserver's ---- [2013-06-24 21:08:07] [email protected] Description: Hi, Consider the test script. One might expect to see: Content-Encoding: gzip in the response headers, but it's not there. If however you comment out that flush() compression is applied. As a small amount of background, I work on two tools that help display data from the xhprof extension. They both include flush(); ignore_user_abort(); before doing work to store the profiling information in attempt to have as little impact on the user as possible. Clearly flush() wasn't the safe command I thought it was, as it's having a large affect on the application I'm profiling. I'm prepared to write this up in the documentation, but I don't really think this is expected behavior. Test script: --- https://bugs.php.net/bug.php?id=65115&edit=1
Bug #65115 [Com]: flush() disables compression from ob_gzhandler
Edit report at https://bugs.php.net/bug.php?id=65115&edit=1 ID: 65115 Comment by: [email protected] Reported by:[email protected] Summary:flush() disables compression from ob_gzhandler Status: Not a bug Type: Bug Package:Output Control Operating System: linux PHP Version:5.4.16 Assigned To:mike Block user comment: N Private report: N New Comment: I'm using the apache 2.0 SAPI. The build of PHP I used to confirm the bug doesn't include XHProf (I wanted a clean build to report on). I built with: Command './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=mysqlnd' '--with-gd' '--enable-soap' '--with-libxml-dir=/usr/lib/' '--with-mysql-sock=/tmp' '--with-tidy' '--with-jpeg-dir=/usr/lib/' '--with-xsl' '--with-curl' '--with-zlib' '--enable-gd-native-ttf' '--with-openssl' '--with-mcrypt' '--with-pdo-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-bz2' '--enable-bcmath' Previous Comments: [2013-06-25 13:49:38] [email protected] Looks like my explanation off the top of my head was not correct. Which SAPI are you using? Does XHPROF override SAPI methods? [2013-06-25 12:33:48] [email protected] So if I run: http://test.local/obtest.php It looks (to me) like the entire output is compressed. The difference in behavior seems, well, necessary to allow the end agent to actually be able to read the output. But confusing from a "different output depending on what happened earlier" standpoint. [2013-06-25 05:30:36] [email protected] Actually, this is debatable. Flush flushes the SAPI's I/O layer and we just note that output has irreversibly sent. If you want to flush the output buffering layer you have to use ob_flush prior flush. [2013-06-25 04:32:20] [email protected] I encountered this problem too. a workaround is don't use php's gzip handler, use the webserver's [2013-06-24 21:08:07] [email protected] Description: Hi, Consider the test script. One might expect to see: Content-Encoding: gzip in the response headers, but it's not there. If however you comment out that flush() compression is applied. As a small amount of background, I work on two tools that help display data from the xhprof extension. They both include flush(); ignore_user_abort(); before doing work to store the profiling information in attempt to have as little impact on the user as possible. Clearly flush() wasn't the safe command I thought it was, as it's having a large affect on the application I'm profiling. I'm prepared to write this up in the documentation, but I don't really think this is expected behavior. Test script: --- https://bugs.php.net/bug.php?id=65115&edit=1
[PHP-BUG] Bug #53169 [NEW]: Segmentation Fault with parse_http_headers()
From: Operating system: Linux PHP version: 5.3.3 Package: Reproducible crash Bug Type: Bug Bug description:Segmentation Fault with parse_http_headers() Description: When running this script at the command line (php ./crash.php) I get a segmentation fault. To reproduce, save this to a script, run an instance of PHP with the pecl_http extension installed, make popcorn. Test script: --- http://www.onefortybpm.com/xmlrpc.php X-Powered-By: PHP/4.4.8 Location: http://www.onefortybpm.com/ Content-Length: 0 Connection: close Content-Type: text/html; charset=UTF-8 DATA; var_dump($data); var_dump(http_parse_headers($data)); Expected result: No seg fault Actual result: -- seg fault. -- Edit bug report at http://bugs.php.net/bug.php?id=53169&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53169&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53169&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53169&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53169&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53169&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53169&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53169&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53169&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53169&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53169&r=support Expected behavior: http://bugs.php.net/fix.php?id=53169&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53169&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53169&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53169&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53169&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=53169&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53169&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53169&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53169&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53169&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53169&r=mysqlcfg
