php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57220 Cacheing is somehow blocking $_REQUEST contents
Submitted: 2006-09-07 08:36 UTC Modified: 2006-09-08 13:16 UTC
From: apc at tequilasolutions dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.1.6 OS: FC4
Private report: No CVE-ID: None
 [2006-09-07 08:36 UTC] apc at tequilasolutions dot com
Description:
------------
I have a file called as download_blob.php?id=xxxxx which pulls data from the database chucks out:
header("Pragma: no-cache");
header("Expires: 1");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",true);
header("Content-Type: $h");
header("Content-Disposition: attachment; filename=$n.$t");
header("Content-Length: $s");
....data

This worked fine in previous versions of APC, now the file reports that the $_REQUEST[] array is empty once cached.

Reproduce code:
---------------
Adding apc.filters="download_blob.php" fixes the problem.

The code is here:
http://www.tequilasolutions.com/download_blob.php.txt

Expected result:
----------------
APC is somehow not passing the $_REQUEST array properly after cacheing this file.

Actual result:
--------------
if (isset($_REQUEST['id'])) /// output data works when not cached

$_REQUEST['id'] is not set when APC has cached the file.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-07 09:46 UTC] rasmus@php.net
Please specify your APC version, and if you are not running the latest, please test with the latest.
 [2006-09-07 10:41 UTC] apc at tequilasolutions dot com
Yes using 3.0.12p2, problem is not there with 3.0.11
 [2006-09-08 02:57 UTC] gopalv82 at yahoo dot com
What does auto_globals_jit in php.ini say ?
 [2006-09-08 05:51 UTC] apc at tequilasolutions dot com
I don't have this setting in my php.ini, my php.ini is pretty much the default distribution file.  The only var set concerning globals is:

register_globals = Off

.. but from php_info() :

auto_globals_jit On
 [2006-09-08 13:16 UTC] gopalv82 at yahoo dot com
Fixed in CVS on 8th Sept 2006 - apc_compile.c, 3.59

Thanks for the nice clean bug, caught two more opcodes which are tagged fetch_global. If you had a $id = $_REQUEST['id']; in code, the bug wouldn't have been triggered :)
 [2006-11-23 09:29 UTC] tim at digicol dot de
This bug just cost me two hours to find...

Thanks for fixing this in CVS - it would be great if you could release a new version of APC soon.

This is a deadly bug for anyone using $_REQUEST, so it's a pity that the fix is two months old and the currently released version is still broken.

Sorry for the "me too" post, and thanks for the great work on APC :-)
 [2009-09-06 09:13 UTC] lauri dot kentta at gmail dot com
I was sending a new bug report, but the system told me there's already a bug for that. So I suppose I'll continue here.

I'm using PHP 5.3.0 with APC 3.1.3p1 through FastCGI interface with a lighttpd server. I carefully tested that the bug really comes only when APC is enabled and the page is cached. Also the suggested work-around ($n = $_REQUEST['n']) fixes it.

Reproduce code:
---------------
<?php
// Run several times with test.php?n=2
if (--$_REQUEST['n']) echo "This is sample output.\n";
?>

Expected result:
----------------
This is sample output.

Actual result:
--------------
Notice: Undefined variable: _REQUEST in /http/test.php on line 3
Notice: Undefined index: n in /http/test.php on line 3
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC