PHP Deprecated: Fun...
Clear all

PHP Deprecated: Function get_magic_quotes_gpc()

1 Posts
1 Users
Posts: 1300
Noble Member
Topic starter

PHP Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/headprefect/public_html/fanfiction/header.php on line 31

"Since PHP no longer adds slashes to request parameters (removed in PHP 5.4), get_magic_quotes_gpc() always returns false. "


"get_magic_quotes_gpc() has been useless ever since PHP 5.4.0. It would tell you whether you have magic quotes switched on in the configuration or not. Magic quotes were a terrible idea and this feature was removed for security reasons (PHP developers believed in magic & superstitions and wrote unsecure code).

"Most likely even you yourself do not know why you had this line of code in your project. I know I was fooled by it when I was learning PHP. The reality is you do not need it at all. This function has nothing to do with security and the concept of input sanitization is preposterous.

"Instead, rely on good security guidelines.

  • Use parameterized prepared statements for interactions with the database. PHP has a very good library called PDO, which can be used with many DB drivers including MySQL.
  • If you produce output, then escape the output taking into consideration the rules of that medium. For example when outputting to HTML use htmlspecialchars() to prevent XSS.
  • Never sanitize input. There is no magical solution that would protect you against everything. Instead, you as a developer must be aware of dangers and you need to know how to protect your code. Don’t try to sanitize input. Escape output."



This topic was modified 4 months ago by Jan_AQ

Whoever said nothing is impossible never tried slamming a revolving door.

php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

Posted : 21/08/2023 2:23 pm