ezsystems/ezpublish-legacy — pull request #787 by jeromegamez (2013-10-10 17:55:15+00:00)
Title: Change constants to strings in array keys

This PR is work in progress, I have only published it already to check if it has a chance of getting merged.

At many locations in the code, constants are used as array keys instead of strings, e.g. `$array[key]` instead of `$array['key']`. This doesn't seem to cause errors, but **if** one day a constant with the same name as a used key was defined somewhere, things could break.

Quoting the [PHP Manual on Arrays](http://de.php.net/manual/en/language.types.array.php#language.types.array.foo-bar):
> **Why is $foo[bar] wrong?**
>
> Always use quotes around a string literal array index. For example, `$foo['bar']` is correct, while `$foo[bar]` is not. But why? It is common to encounter this kind of syntax in old scripts:
```php

```
> This is wrong, but it works. The reason is that this code has an undefined constant (bar) rather than a string ('bar' - notice the quotes). PHP may in the future define constants which, unfortunately for such code, have the same name. It works because PHP automatically converts a bare string (an unquoted string which does not correspond to any known symbol) into a string which contains the bare string. For instance, if there is no defined constant named bar, then PHP will substitute in the string 'bar' and use that.

If I would continue to replace these occurrences everywhere I find them, would this be getting merged back into master? What would be the requirements? One commit per file instead of on commit that includes everything?

I appreciate your feedback!
:octocat: Jérôme