6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
9/21/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#3957] call_user_func always passes copy of Turba object to _turba_hook_encode_{attribute}
*
Your Email Address
*
Spam protection
Enter the letters below:
. .. ,. ,. ..__ |_/ \./ \./ | || \ | \ | | |__||__/
Comment
>> True, but it's also useful to be able to modify the object, and part >> of the reason the $this > >> parameter was added. Can you test with using &$this instead of $this >> with the call_user_func > >> syntax? > > > > That works, but you'll always get a reference. Here's an example: > > > > function foo($x) > > { > > $x = 42; > > } > > function bar(&$x) > > { > > $x = 43; > > } > > $y = 0; > > call_user_func('foo', &$y); > > print "$y\n"; # -> 42 > > call_user_func('bar', &$y); > > print "$y\n"; # -> 43 > > > > If the function is called directly you can decide in the hook > function whether you'd like to get a reference or a copy: > > > > function foo($x) > > { > > $x = 42; > > } > > function bar(&$x) > > { > > $x = 43; > > } > > $y = 0; > > foo($y); > > print "$y\n"; # -> 0 > > bar($y); > > print "$y\n"; # -> 43 > > > > I don't know what's more sensible in this case.
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