Update to the MODDB policy for phpBB3.

Discussion forum for MOD Writers regarding MOD Development.
User avatar
primehalo
Former Team Member
Posts: 2702
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Update to the MODDB policy for phpBB3.

Post by primehalo » Sat Jun 30, 2012 11:51 pm

I think we're getting off-topic here. But no, that is not the same thing. That returns a default value if the variable is not set. There are circumstances where you will want to perform a specific action when the variable is not set, not just return a value or set it to a value.

There isn't a reason to prefer != over <>, but if you need to compare types as well as values then you'll need to use !== because as far as I know !<> doesn't exist.
Ken F. Innes IV
My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

darksminky
Registered User
Posts: 132
Joined: Wed Jan 26, 2011 9:13 pm

Re: Update to the MODDB policy for phpBB3.

Post by darksminky » Sun Jul 01, 2012 1:09 am

I suppose we are off topic. ..
primehalo wrote: you will want to perform a specific action when the variable is not set
and that's what I was suggesting with using an if statement in that fashion, because if the variable isn't set, it outputs the default that the if statement tests for, thus testing for whether it's a set indirectly, but accurately.

User avatar
primehalo
Former Team Member
Posts: 2702
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Update to the MODDB policy for phpBB3.

Post by primehalo » Sun Jul 01, 2012 2:18 am

darksminky wrote:if the variable isn't set, it outputs the default that the if statement tests for, thus testing for whether it's a set indirectly, but accurately.
Testing for default matches and testing for isset are not one in the same, because the value of the variable could be the same your the default value. You're saying this condition is the same as checking for !isset($_GET['foo']):

Code: Select all

if (request_var('foo', 'bar') == 'bar')
{
}
But this will return true if $_GET['foo'] isn't set and if $_GET['foo'] is set and equal to 'bar'. If you're trying to perform an action only if it isn't set then you have to use isset().
Ken F. Innes IV
My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

darksminky
Registered User
Posts: 132
Joined: Wed Jan 26, 2011 9:13 pm

Re: Update to the MODDB policy for phpBB3.

Post by darksminky » Sun Jul 01, 2012 2:48 am

Ah, I see what your saying, though one could do that if the default was illegal, which would rarely be the case
(ditch an if(!empty()) for a if(request_var('foo','') == '') for instance.)
Though I see the point you were making

My bad! :oops:

darksminky
Registered User
Posts: 132
Joined: Wed Jan 26, 2011 9:13 pm

Re: Update to the MODDB policy for phpBB3.

Post by darksminky » Fri Oct 12, 2012 4:56 pm

maybve we should draft a rule illegalizing editing a config value outside of the ACP

Locked

Return to “[3.0.x] MOD Writers Discussion”

Who is online

Users browsing this forum: No registered users and 18 guests