Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 297969

Call PHP native functions fully qualified (like \array_key_exists())

$
0
0

Problem/Motivation

PHP has opcode implementations for a subset of core functions, one of these is array_key_exists(), see #3346645: Eliminate anti-pattern isset($arr[$key]) || array_key_exists($key, $arr).

Drupal so far does not call PHP native functions like \array_key_exists(), which means that PHP is unable to apply the opcode optimisation, since it needs to check for a function defined in the namespace first.

Steps to reproduce

Proposed resolution

Since the list of functions that have opcode implementations is subject to change, we should do this for all PHP native functions.

Beyond that, should we make this change only in namespaced code, or also in non-namespaced (procedural) code. It doesn't matter in procedural code, but it would be consistent and possibly help when code is copy and pasted around.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 297969

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>