Integration question about globals

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
omniError
Registered User
Posts: 6
Joined: Thu Jun 26, 2014 3:29 pm

Integration question about globals

Post by omniError »

Hello, I'm taking the 3.1 RC for a spin and planning an integration with an existing CMS. First let me say I appreciate the new events dispatcher a lot. :)

My question is about super globals. For reasons I would rather not rehash, I need them on. I see that the constructor for the \phpbb\request class has a second parameter which controls this. The class also has an enable_super_globals() function. What would be the most correct way to do this without editing any core files?

Thanks.

User avatar
MattF
Extension Customisations
Extension Customisations
Posts: 675
Joined: Mon Mar 08, 2010 9:18 am

Re: Integration question about globals

Post by MattF »

It looks like you can just call $request->enable_super_globals();

https://github.com/phpbb/phpbb/blob/dev ... hp#L71-L74
Has an irascible disposition.

Nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 299
Joined: Sun Apr 13, 2014 1:40 am
Location: Paris

Re: Integration question about globals

Post by Nicofuma »

it could work if in your extension you override the request service like this: (but i'm not sure^^)

Code: Select all

    request:
        class: phpbb\request\request
        arguments:
            - null
            - false
EDIT: but it could be better to call enable_super_globals
Member of the phpBB Development-Team
No Support via PM

omniError
Registered User
Posts: 6
Joined: Thu Jun 26, 2014 3:29 pm

Re: Integration question about globals

Post by omniError »

Nicofuma's approach worked, although I don't know if that has any other consequences (like passing null for the first parameter). Would it?
I got tripped up a bit since I didn't know about clearing the cache after changing that file.

Nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 299
Joined: Sun Apr 13, 2014 1:40 am
Location: Paris

Re: Integration question about globals

Post by Nicofuma »

indeed, when you change the configuration of the container (services.yml) you need to purge the cache or to disable/re-enable your extension.

About the null parameter it will not change anything the core use: (if i expand the default parameters)

Code: Select all

    request:
        class: phpbb\request\request
        arguments:
            - null
            - true
Member of the phpBB Development-Team
No Support via PM

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: Integration question about globals

Post by bantu »

omniError wrote:The class also has an enable_super_globals() function. What would be the most correct way to do this without editing any core files?
Calling that method is the intended way to get back super globals.

Post Reply