Break infinite loop while resolving aliases

| Q             | A
| ------------- | ---
| Bug fix?      | [yes]
| New feature?  | [no]
| BC breaks?    | [no]
| Deprecations? | [no]
| Tests pass?   | [yes]
| Fixed tickets | []
| License       | MIT
| Doc PR        | []
Because `in_array` (a `PHP_FUNCTION`) is significantly slower than `isset` (`ZEND_ISSET_ISEMPTY_DIM_OBJ`) and this will fire really often while the `array_values()` call will fire almost never.