6.0.0-beta6
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
4/10/26
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#6837] Singletons and references
*
Your Email Address
*
Spam protection
Enter the letters below:
. ._..___.__ . . | | [__ [__)|__| |____|_[___[__)| |
Comment
> Hello together, > > > > I'm currently debugging a heap memory corruption in PHP (5.2.6) using Horde > > and noticed some odd behavior regarding references and static variables. > > Currently we implement some of our singletons like this: > > > > ----------------------------- > > function &singleton() > > { > > static $history; > > > > if (!isset($history)) { > > $history = &new Horde_History(); > > } > > > > return $history; > > } > > ----------------------------- > > > > I've found out that the singleton is not working and it's related to this: > > http://www.php.net/manual/en/language.variables.scope.php > > The part with "References with global and static variables" is important. > > > > -> The code has to be changed to "$history = new Horde_History();" > > Singletons storing their references via an array are unaffected. > > > > If there a no objections I'll start fixing the static variables. > > > > I really hope this will solve my trouble (=segfaults) deep inside > > the PHP memory manager during request shutdown. Spending two days > > in gdb, debugging internal PHP memory structures is no fun at all :o) > > > > Cheers, > > Thomas > >
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers