Magic Quotes - Other Approaches

Other Approaches

  • Some languages such as Perl and Ruby opt for an approach involving data tainting, where data from untrusted sources, such as user input, are considered "tainted" and can not be used for dangerous operations until explicitly marked as trustworthy, usually after validation and/or encoding. Since the construction of SQL queries is considered "dangerous" in this context, this forces the programmer to address the problem. Tainting does not solve the problem, but it does highlight those instances where there is a problem so that the programmer is able to solve them appropriately.
  • Joel Spolsky has suggested using a form of Hungarian notation that indicates whether data are safe or unsafe.
  • Modern database engines and libraries use parameterised queries to pass data to the database separately from SQL commands, greatly reducing the need to escape data before constructing the queries.

Read more about this topic:  Magic Quotes

Famous quotes containing the word approaches:

    A politician is a statesman who approaches every question with an open mouth.
    Adlai Stevenson (1900–1965)

    As the truest society approaches always nearer to solitude, so the most excellent speech finally falls into Silence. Silence is audible to all men, at all times, and in all places. She is when we hear inwardly, sound when we hear outwardly. Creation has not displaced her, but is her visible framework and foil. All sounds are her servants, and purveyors, proclaiming not only that their mistress is, but is a rare mistress, and earnestly to be sought after.
    Henry David Thoreau (1817–1862)