To deprecate or not to deprecate

As of version 5.3 of PHP, certain features and functions are considered deprecated. It comes with the territory. In major version changes, new features are added while old stuff is discarded. Unsurprisingly – and lucky for me, with that change in versions comes yet another WTF for me to rant about.

magic_quotes_gpc is deprecated, is it not?

The PHP manual warns us not to rely on certain settings as of PHP 5.3.0 because they’ve been deprecated. This is the case with magic_quotes_gpc. Keeping this configuration directive in a php.ini will certainly produce an E_DEPRECATED warning:

Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0

I was irritated however, when I took a look at the results of phpinfo() spilling guts:

The output has been generated like so:

gore@ghoti:~/.temp# echo '<?php phpinfo();' > phpinfo.php
gore@ghoti:~/.temp# PHPRC=/dev/null php5 -n phpinfo.php > phpinfo.html

From this, one can see that

  1. in order to read default values only, I made doubly sure that absolutely no php.ini would be parsed.
  2. a setting – regarded deprecated – defaults to On.


Leave a Reply

Your email address will not be published. Required fields are marked *