frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

In worker mode, $_REQUEST is incorrectly cached

Open phenixsoul opened this issue 2 months ago • 6 comments

What happened?

Laravel Octance Configure the following a simple routes in Laravel:

Route::get('/test', function () {
    $foo = $_REQUEST['foo'] ?? 'null';
    return $foo;
});

The php.ini item: auto_globals_jit = On // Default Configuration

1、Go to http://127.0.0.1:8000/test?foo=test1 //echo test1 2、Go to http://127.0.0.1:8000/test?foo=test2 //echo test1

But $_GET/$_POST is work.

When php.ini: auto_globals_jit = Off

1、Go to http://127.0.0.1:8000/test?foo=test1 //echo test1 2、Go to http://127.0.0.1:8000/test?foo=test2 //echo test2

$_REQUEST is work.

Build Type

Docker (Debian Bookworm)

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

auto_globals_jit = On

Relevant log output


phenixsoul avatar Oct 17 '25 06:10 phenixsoul

Yes, $_REQUEST is currently not supported in worker mode. It only works with auto_globals_jit disabled. Probably makes sense to document this.

Enabling it by default would add an overhead (and apparently not many people are using it).

AlliBalliBaba avatar Oct 17 '25 16:10 AlliBalliBaba

I believe this is due to bypassing filters? I can't remember, but I'll check when I rebase #1658

withinboredom avatar Oct 22 '25 17:10 withinboredom

No this was always the case. Only $_SERVER is explicitly reloaded

AlliBalliBaba avatar Oct 22 '25 21:10 AlliBalliBaba

不,一直都是这样。只有 $_SERVER 被明确重新加载

Are there any other situations that are inconsistent with the classic mode? Can these differences be supplemented in the document? After all, these are not prohibited in PHP src, and any kind of code in reality can appear. As an ordinary developer, I am refactoring old projects and preparing to apply Frankenphp to production environments. These unknown information have raised some concerns for our team about this new technology

phenixsoul avatar Oct 23 '25 02:10 phenixsoul

IMHO we should consider this a bug and fix it, even if there is a small performance penalty. Maybe can we provide an option to opt-out, but compatibility with normal PHP is key.

dunglas avatar Oct 23 '25 07:10 dunglas

@phenixsoul I would say this is probably a bug/oversight as this appears to be the first time it is reported -- so, like @AlliBalliBaba mentioned, it doesn't appear to be used often.

withinboredom avatar Oct 23 '25 07:10 withinboredom