SitePoint Sponsor |
|
User Tag List
Results 26 to 50 of 75
-
Mar 10, 2006, 11:15 #26
- Join Date
- Feb 2006
- Location
- Pittsburgh, Los Angeles
- Posts
- 706
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
And for your knowledge all my _GET, _POST, _SESSION and _COOKIE, etc. data is wrapped in a nice object and then unset.
-
Mar 10, 2006, 11:23 #27
Originally Posted by Snaily
And "inefficient", that's like what 0.0000001 of total execution time or 0.00001% of a sql query. If you're going to critizise the way someone else does something, atleast give a valid argument... ignorance.. *sigh*
-
Mar 10, 2006, 11:42 #28
I think there are distinct advantages to wrapping the superglobals into an object.
- Testing, can mock the object, and thus test everything that uses them.
- Have to deal with configuration/enviroment issues, things like magic_quotes, and perhaps perform some normalization of $_SERVER across web server software (IIS/Apache/etc).
-
Mar 10, 2006, 11:50 #29
- Join Date
- Feb 2006
- Location
- Pittsburgh, Los Angeles
- Posts
- 706
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
And "inefficient", that's like what 0.0000001 of total execution time or 0.00001% of a sql query. If you're going to critizise the way someone else does something, atleast give a valid argument... ignorance.. *sigh*
And I'll have complete controll over what parts of my application that need the session/etc. data.
Anyhow most of PHP's core is not object based....creating wrappers around it is pointless and highly inefficient and another language should be used if that is what is desired.
Testing, can mock the object, and thus test everything that uses them.
-
Mar 10, 2006, 11:57 #30
- Join Date
- Sep 2004
- Location
- Zagreb, Croatia
- Posts
- 830
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Snaily, POITROAE...
-
Mar 10, 2006, 12:00 #31
- Join Date
- Feb 2006
- Location
- Pittsburgh, Los Angeles
- Posts
- 706
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Snaily, POITROAE...
-
Mar 10, 2006, 12:09 #32
Originally Posted by Snaily
(God, I shouldn't feed the trolls =/)
-
Mar 10, 2006, 12:15 #33
- Join Date
- Feb 2006
- Location
- Pittsburgh, Los Angeles
- Posts
- 706
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'd say it's only a kid who says someone else is a kid
God, I shouldn't feed the trolls =/
-
Mar 10, 2006, 12:18 #34
- Join Date
- Jan 2003
- Posts
- 5,748
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
> Futhermore your response is silly. This is a clear case of over-design..
No it's not... It's called encapsulation
> creating wrappers around it is pointless and highly inefficient and another language should be used
> if that is what is desired.
As I said above, you gain encapsulation, also you gain a few other benifits; I think Ren spelled them out to you?
If you are going to come to the PAD forum and pick an arguement with someone then at least make sure you are well versed in the current methodologies, etc that we all practice in the forum, before you do so, as yes - you do come across as being ignorant.
-
Mar 10, 2006, 12:32 #35
- Join Date
- Sep 2004
- Location
- Zagreb, Croatia
- Posts
- 830
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Snaily
-
Mar 10, 2006, 12:37 #36
God, I shouldn't even dignify that post with an answer... starting to ***** about age now? sigh...
-
Mar 10, 2006, 13:09 #37
Originally Posted by Snaily
-
Mar 10, 2006, 13:17 #38
Originally Posted by DerelictMan
-
Mar 10, 2006, 13:43 #39
Originally Posted by thr
But in practice, I really fail to see how it is really any different than the idea of magic quotes. Both capture user input and perform some mass transformation on the captured user input. The idea on its surface is not too bad, but in practice it ends up creating more problems than it solves.
Real though, I think you're just being a bit too schizophrenic. [God I hope not, but no offense meant to anyone who actually suffers from schizophrenia]
-
Mar 10, 2006, 13:53 #40
- Join Date
- Feb 2006
- Location
- Pittsburgh, Los Angeles
- Posts
- 706
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No it's not... It's called encapsulation
If you are going to come to the PAD forum and pick an arguement with someone then at least make sure you are well versed in the current methodologies, etc that we all practice in the forum, before you do so, as yes - you do come across as being ignorant.
-
Mar 10, 2006, 13:59 #41
Originally Posted by dreamscape
Originally Posted by dreamscape
- I have complete controll over what parts of my application that gets access to input data.
- Strip magic_quotes_gpc automaticly
These are by far the two most important ones, others are such as Ren said for testing purposes and I can also apply input filters on the objects if I want to apply specific regexp/other rules on the data.
Now tell me how's this anything like mq_gpc which just quotes everything?
Originally Posted by dreamscape
-
Mar 10, 2006, 14:00 #42
Originally Posted by Snaily
-
Mar 10, 2006, 14:07 #43
- Join Date
- Jan 2005
- Location
- United Kingdom
- Posts
- 208
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How about staying on topic and cutting down on the insults.
-
Mar 10, 2006, 14:07 #44
- Join Date
- Sep 2004
- Location
- Zagreb, Croatia
- Posts
- 830
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This is actually a simple problem.
If you have only data, with no behavior (methods) except for getting and setting, leave it in arrays. If there is some behavior, put it into objects.
In other words, thr has a point to move the superglobal data into objects if he does something with it (specifically, he validates it); now, whether all of this data warrant such treatment is a separate issue.
-
Mar 10, 2006, 14:08 #45
- Join Date
- Jan 2003
- Posts
- 5,748
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
> Then tell me oh so aged god, how should it be done in your bible?
Oh mighty one... I want to be enlightened too.
-
Mar 10, 2006, 14:18 #46
- Join Date
- Oct 2004
- Location
- Worcester
- Posts
- 138
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The Zend guys think wrapping $_POST into an object isn't a bad idea either:
From the manual:
"Zend_InputFilter sets the array that is passed ($_POST) to NULL, so direct access is no longer possible. (The raw data is only available through the getRaw() method, which is much easier to monitor and/or avoid altogether.)"
PHP Code:$filterPost = new Zend_InputFilter($_POST);
$alphaName = $filterPost->isAlpha('name');
if ($alphaName !== FALSE) {
/* $alphaName contains only alphabetic characters. */
} else {
/* $alphaName === FALSE */
}
-
Mar 10, 2006, 14:26 #47
- Join Date
- Feb 2006
- Location
- Pittsburgh, Los Angeles
- Posts
- 706
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Then tell me oh so aged god, how should it be done in your bible? Just leave the input data as it is, run "some_func_that_cleanas_them()" before I use them every time? Enlighten me/us, please.
And for your knowledge all my _GET, _POST, _SESSION and _COOKIE, etc. data is wrapped in a nice object and then unset.
The Zend guys think wrapping $_POST into an object isn't a bad idea either
-
Mar 10, 2006, 14:29 #48
- Join Date
- Nov 2002
- Posts
- 841
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Ren
-
Mar 10, 2006, 14:30 #49
Originally Posted by Snaily
Originally Posted by Snaily
-
Mar 10, 2006, 14:31 #50
- Join Date
- Nov 2002
- Posts
- 841
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Zend_InputFilter sets the array that is passed ($_POST) to NULL
Bookmarks