With phpbb3.1 it appears they have disabled more superglobals.
I have tried passing a variable between using sessions, but have had no success.
$_SESSION['example'] = 'example';
$example = $_SESSION['example'];
Nothing is stored because nothing is there due to phpbb disabling superglobals. What's the next best and most secure way to pass variables in between pages?
I'm not sure if $_SESSION
is included, but try phpBBs request
class...
$example = $request->variable('example','');
Docs for the class are here - https://wiki.phpbb.com/PhpBB3.1/RFC/Request_class
You might want to take a look at this answer, where I explained that you can also temporarily (or globally) switch Superglobals back:
Globally
Open the /phpbb/config/parameters.yml
file and change the core.disable_super_globals key from true
to false
.
Programmatically
This is a sample code that can be used to temporarily enable superglobals (per-request scope):
// temporarily enable superglobals
$request->enable_super_globals();
// TODO: do your stuff here.
// disable superglobals again
$request->disable_super_globals();
You can also read this blog post that I wrote on this topic for further info.