Jump to content

ponderous2k

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by ponderous2k

  1. Yes, this concept makes sense, and it's what I've based all my programming around thus far in my career. But for some reason I found myself doubting suddenly the reliability of my data. Thanks for your help.
  2. Thanks for the reply. OK. So each page request uses a fresh "copy" of the Validate::$valid and Validate::$errors static properties? This topic stems from a question posed by another regarding instantiated VS static classes. The link and offending quote follows: http://stackoverflow.com/questions/1185605/when-to-use-static-vs-instantiated-classes/1185633
  3. I forgot to state why exactly what I think the problem is. As you can see, the parameters are determined to be either valid or invalid, and are then added to the appropriate static array. After all inputs have been validated and none are determined to be erroneous, the static array $valid is used to pass information onto other classes and the database, like: if (empty(Validate::$errors)) { CreateSubscription(Validate::$valid['email']); } So can the data be corrupted by the time it gets to that point, say, if a third or fourth user were to submit data to the Validate class just before the other user's CreateSubscription method were called?
  4. Hello, my first post here. I created a Validation class that depends entirely on static methods. It appears to be working well, but perhaps I misunderstood exactly the purpose and the consequences of using static methods. My class essentially looks like this: class Validate { static public $errors = array(); static public $valid = array(); static public function Name($name) { if ($name != '') { self::$valid['name'] = $name; return true; } else { self::$errors['name'] = 'Name is empty'; return false; } } } Does this create any chance whatsoever for a collision of data from multiple users? I am beginning to think it does, simply because from what I have recently learned about static methods, theyr'e essentially global variables because they are not instantiated. If that's the case, then it would seem possible that during times of heavy use, any application depending on this class would confuse submitted data. Any thoughts? Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.