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.

CommentFileSizeAuthor
variable_del.patch496 byteschx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

This needs backporting to D6 and D5 and... every Drupal :p

sun’s picture

Issue tags: +PHPWTF

Tagging. This issue tag will give us a very nice list developers can learn from.

Dries’s picture

Version: 7.x-dev » 6.x-dev
Status: Needs review » Reviewed & tested by the community

Wow, nice catch. Committed to CVS HEAD. Thanks.

Pasqualle’s picture

Version: 6.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Needs review

the patch was rolled back.. reason?
http://drupal.org/cvs?commit=215554

chx’s picture

Major 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.

chx’s picture

Status: Needs review » Closed (fixed)