diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-12-14 18:46:21 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-12-14 18:46:21 +0000 |
commit | c4fc7f401f80c26a3d96106a67ae7247edf8996f (patch) | |
tree | 9791eb9da94a96c08a4485df89a2e187bd96bbab | |
parent | ca9aa560f2bdf49f48b8e20e5b6c9510e938e655 (diff) | |
download | brdo-c4fc7f401f80c26a3d96106a67ae7247edf8996f.tar.gz brdo-c4fc7f401f80c26a3d96106a67ae7247edf8996f.tar.bz2 |
- Patch #40886 by chx: fixed problem with recursive/nested node API calls manipulating the same array references.
-rw-r--r-- | includes/module.inc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/includes/module.inc b/includes/module.inc index dfa31a91d..748333a35 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -142,7 +142,13 @@ function module_implements($hook) { } } - return $implementations[$hook]; + // The explicit cast forces a copy to be made. This is needed because + // $implementations[$hook] is only a reference to an element of + // $implementations and if there are nested foreaches (due to nested node + // API calls, for example), they would both manipulate the same array's + // references, which causes some modules' hooks not to be called. + // See also http://www.zend.com/zend/art/ref-count.php. + return (array)$implementations[$hook]; } /** |