summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-10-13 01:01:46 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-10-13 01:01:46 -0400
commitff246ebcc9b67f7a47ad52529ae81a60a3269305 (patch)
tree01dc82863f51fa3ff88a958826c62a4fce23caf0
parentd3e02219e85bc9335aef13ad7cb668025a7cba11 (diff)
downloadbrdo-ff246ebcc9b67f7a47ad52529ae81a60a3269305.tar.gz
brdo-ff246ebcc9b67f7a47ad52529ae81a60a3269305.tar.bz2
Issue #2146643 by quicksketch: Speed up drupal_parse_info_format() 3x and reduce memory 95%
-rw-r--r--CHANGELOG.txt2
-rw-r--r--includes/common.inc5
2 files changed, 4 insertions, 3 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index f23b9c993..ed1dd62bd 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,8 @@
Drupal 7.40, xxxx-xx-xx (development version)
-----------------------
+- Made Drupal's code for parsing .info files run much faster and use much less
+ memory.
- Prevented drupal_http_request() from returning an error when it receives a
201 through 206 HTTP status code.
- Added support for autoloading traits via the registry on sites running PHP
diff --git a/includes/common.inc b/includes/common.inc
index ab763bad7..e5e8150dc 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -7468,7 +7468,6 @@ function drupal_parse_info_file($filename) {
*/
function drupal_parse_info_format($data) {
$info = array();
- $constants = get_defined_constants();
if (preg_match_all('
@^\s* # Start at the beginning of a line, ignoring leading whitespace
@@ -7508,8 +7507,8 @@ function drupal_parse_info_format($data) {
}
// Handle PHP constants.
- if (isset($constants[$value])) {
- $value = $constants[$value];
+ if (preg_match('/^\w+$/i', $value) && defined($value)) {
+ $value = constant($value);
}
// Insert actual value.