Incorrect highlighting of superglobals and predefined constants
ATM, php-mode treats all constants and superglobals as case-insensitive, i.e. $_server or pHp_VeRsIon are highlighted as if the were correct, but PHP will only throw errors if you run this.
From what I've gathered from the PHP documentation, only the eight magic constants are case-insensitive. All superglobals and predefined constants and the ones from core extensions are case-sensitive, and should only be highlighted if they are all caps
I started work on this but I'm going to have to email some more knowledgable Elisp programmers to find the best way to resolve it.
In case anyone cares to follow the related Q&A on gmane.emacs.help:
http://permalink.gmane.org/gmane.emacs.help/89444
I could not find any way to tell font-lock to treat some regular expressions in a case-insensitive way. So what I am doing is making php-mode treat all regular expressions as case-sensitive by default and then I'm going to manually craft expressions for the magic constants that are case-insensitive. Here is a utility function I wrote to help create those expressions, which others may find useful.
(defun make-case-insensitive-regexp (word)
"Make a case-insensitive regular expression matching WORD."
(apply (function concat)
(mapcar #'(lambda (character)
(if (char-equal ?_ character)
(string character)
(string ?\[
(downcase character)
(upcase character)
?\])))
word)))
So for example (make-case-insensitive-regexp "__FUNCTION__") returns the string "__[fF][uU][nN][cC][tT][iI][oO][nN]__". Not pretty, but the best solution I could come up with. So hopefully I can write a full patch to fix this issue soon.