Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Whack. Who signed off those patches?
Comment | File | Size | Author |
---|---|---|---|
#5 | drupal8.static.5.patch | 6.99 KB | sun |
drupal8.static.0.patch | 3.15 KB | sun | |
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 CreditAttribution: 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()