Stop disabling super globals

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
A_Jelly_Doughnut
Registered User
Posts: 1780
Joined: Wed Jun 04, 2003 4:23 pm

Re: Stop disabling super globals

Post by A_Jelly_Doughnut » Mon Jan 13, 2014 5:03 am

Prior to Symfony Forms 2.3.0, there was no DI available for the class David pointed out.

But, now, there is.
https://github.com/symfony/symfony/blob ... LOG.md#230
(See fourth bullet)
Also, the commit that implements the change

I haven't fully investigated the impllications, but in the 10 minutes I spent on this, it seems easy enough?

(@Exreaction: I didn't immediately see a branch at github.com/exreaction/phpbb3 that made me think "that's the right one", so I didn't look at your code at all, if it is published)
A_Jelly_Doughnut

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: Stop disabling super globals

Post by EXreaction » Mon Jan 13, 2014 6:54 am

Yes, I've been using that (it's an open, WIP PR, but I may not have pushed all of my local changes, it's been a while)

Perhaps it is simply something that was over-looked and needs to be fixed. I've opened a bug ticket on their tracker. https://github.com/symfony/symfony/issues/10009

sajaki
Registered User
Posts: 86
Joined: Mon Jun 21, 2010 8:28 pm

Re: Stop disabling super globals

Post by sajaki » Mon Jan 13, 2014 4:54 pm

hi,
does this mean that in 3.1, this isset ( $_POST ['templatevariable'] won't work because there's no $_POST array anymore ?

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: Stop disabling super globals

Post by imkingdavid » Mon Jan 13, 2014 8:49 pm

sajaki wrote:hi,
does this mean that in 3.1, this isset ( $_POST ['templatevariable'] won't work because there's no $_POST array anymore ?
I believe isset() is allowed, but in 3.1 is it strongly recommended that you just use $request->is_set_post('templatevariable');
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
Marc
Development Team Leader
Development Team Leader
Posts: 123
Joined: Thu Sep 09, 2010 11:36 am
Location: Munich, Germany

Re: Stop disabling super globals

Post by Marc » Mon Jan 13, 2014 9:20 pm

Please don't use globals like $_POST in 3.1. There are methods like $request->is_set() and $request->is_set_post().

User avatar
wintstar
Registered User
Posts: 108
Joined: Sun Dec 02, 2012 1:38 pm
Location: Lanngöns/Hessen Germany
Contact:

Re: Stop disabling super globals

Post by wintstar » Mon Jan 13, 2014 9:30 pm

I have a problem with

Code: Select all

$this->setSessionIP($_SERVER['REMOTE_ADDR']);
Error message
Illegal use of $_SERVER. You must use the request class or request_var() to access input data. This error message was generated by deactivated_super_global.
Greeting Stephan :-)

Quote: "To achieve the possible, the impossible has to be tried again and again" (Hermann Hesse (1877-1962)).
A look into the future phpBB 3.1.0 - Board, current Builds
A look into the future phpBB 3.1.0 - Board-Plus, Extensions in the test

User avatar
Marc
Development Team Leader
Development Team Leader
Posts: 123
Joined: Thu Sep 09, 2010 11:36 am
Location: Munich, Germany

Re: Stop disabling super globals

Post by Marc » Mon Jan 13, 2014 9:40 pm

Maybe use $request->server('REMOTE_ADDR')?

User avatar
wintstar
Registered User
Posts: 108
Joined: Sun Dec 02, 2012 1:38 pm
Location: Lanngöns/Hessen Germany
Contact:

Re: Stop disabling super globals

Post by wintstar » Mon Jan 13, 2014 9:48 pm

Thanks Marc, but comes the next Error

Undefined variable: request
Greeting Stephan :-)

Quote: "To achieve the possible, the impossible has to be tried again and again" (Hermann Hesse (1877-1962)).
A look into the future phpBB 3.1.0 - Board, current Builds
A look into the future phpBB 3.1.0 - Board-Plus, Extensions in the test

User avatar
Marc
Development Team Leader
Development Team Leader
Posts: 123
Joined: Thu Sep 09, 2010 11:36 am
Location: Munich, Germany

Re: Stop disabling super globals

Post by Marc » Mon Jan 13, 2014 10:00 pm

You have to use the global variable $request or pass the request class to your service container. It obviously won't work otherwise.

User avatar
wintstar
Registered User
Posts: 108
Joined: Sun Dec 02, 2012 1:38 pm
Location: Lanngöns/Hessen Germany
Contact:

Re: Stop disabling super globals

Post by wintstar » Mon Jan 13, 2014 10:02 pm

Thanks Marc, that helps me to further.
Greeting Stephan :-)

Quote: "To achieve the possible, the impossible has to be tried again and again" (Hermann Hesse (1877-1962)).
A look into the future phpBB 3.1.0 - Board, current Builds
A look into the future phpBB 3.1.0 - Board-Plus, Extensions in the test

Post Reply