I notice now that you used a different signature in RequestHandler in order to distinguish between optional and mandatory parameters in Request.
I used $default = 'none' so missing argument can be easily detected to assume that parameter is mandatory.
If you really prefer your approach, you should use $required=true as it refers to the condition of accessing $_REQUEST element with no previous isset test.
This is, for example, what happened in original getSingleElement.php code; using my version and $required=false, exception will be avoided, but I'm not sure that you really want this.
Let me know before I proceed supplying you other code.
Best Regards
I used $default = 'none' so missing argument can be easily detected to assume that parameter is mandatory.
I prefer the explicit $required parameter, because 'none' is a string and could be a possible default value.
If you really prefer your approach, you should use $required=true as it refers to the condition of accessing $_REQUEST element with no previous isset test.
You're right. I prefered the default to false because it would not raise "Hack Detected" when not necessary. But in the other hand it will not when nedded...
I think best is to set signature as
getValue($code,$required,$default=null)
with no default value for $required.
This way, we'll have to think about need for a required Request attribute or not.
I'll keep existing signature until sure all calls have been upgraded...
En poursuivant votre navigation, vous acceptez le dépôt de cookies tiers destinés au bon fonctionnement et à la sécurisation du site (gestion de session, reCaptcha) et à une analyse statistique anonymisée des accès sur notre site (Google Analytics). Si vous vous inscrivez, les informations que vous fournirez ne seront jamais divulguées à un tiers sous quelque forme que ce soit. En savoir plus
Cookies settings
×
Functional Cookies
Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.
Session
Please login to see yours activities!
Other cookies
Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.