Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
10 Jul 2011 at 02:26 UTC
Updated:
29 Jul 2014 at 19:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sunComment #2
catchWhy the changes to drupal_static() itself? That needs an explanation.
Comment #3
sunThat's a trivial change actually -- as the directly preceding comment explains, the function resets all statics to their defaults. However, it does not limit that operation to the $reset = TRUE case.
In order to see everything that's in drupal_static() and find these unnecessary statics in the first place, I called:
and I naturally expected that passing FALSE for $reset does not reset anything - sounds logical, right? :) Instead, I expected to have it return everything it has.
1 days to next Drupal core point release.
Comment #4
catchLooks like a good change, but the drupal_static() tests should probably have caught this.
Comment #5
sunThanks! I've added assertions for that expectation and improved the drupal_static() test in general.
Comment #6
patrickd commentedI've a general performance question on drupal_static
if (isset($data[$name]) || array_key_exists($name, $data)) {array_key_exists costs the most performance in drupal_static, but why is the
isset($data[$name])not enough?// edit
Removing
array_key_exists($name, $data)the exclusive wall time dropped from 1.0% to 0.5% avg. (tested on my laptop).Adding
made no significant difference for me
// edit :P
just talked in irc about this (
array_key_exists($name, $data)) isset would return false if the value is null even if the key exists.. that's the reasonComment #7
sun#5: drupal8.static.5.patch queued for re-testing.
Comment #9
sunThis issue appears to be obsolete; #1577902: [META] Remove all usages of drupal_static() & drupal_static_reset()