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.
If a globalized variable is unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was called.
Comment | File | Size | Author |
---|---|---|---|
variable_del.patch | 496 bytes | chx | |
Comments
Comment #1
chx CreditAttribution: chx commentedThis needs backporting to D6 and D5 and... every Drupal :p
Comment #2
sunTagging. This issue tag will give us a very nice list developers can learn from.
Comment #3
Dries CreditAttribution: Dries commentedWow, nice catch. Committed to CVS HEAD. Thanks.
Comment #4
Pasquallethe patch was rolled back.. reason?
http://drupal.org/cvs?commit=215554
Comment #5
chx CreditAttribution: chx commentedMajor PHPWTF is the reason. unset($conf[$name]) works. unset($conf) does not. See, the problem is that $conf is a reference to a global store and unset $conf only unsets this reference, thats why the global store can not be simply unset by unset($conf). However, unset($conf[$name]) simply changes the value of the $conf array which works.
Comment #6
chx CreditAttribution: chx commented