Summary | Fix for PHP4 reference handling |
Queue | Kronolith |
Queue Version | HEAD |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | chuck (at) horde (dot) org |
Requester | thomas.jarosch (at) intra2net (dot) com |
Created | 05/14/2007 (6600 days ago) |
Due | |
Updated | 05/25/2007 (6589 days ago) |
Assigned | 05/14/2007 (6600 days ago) |
Resolved | 05/17/2007 (6597 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
New Attachment: framework-share-reference-fix2.patch
didn't want to commit it directly to CVS, so please have a look. I
hope it's the last patch in this area :-)
State ⇒ Resolved
Assigned to Chuck Hagenbuch
comment states it should return a concrete instance of a driver, but
as far as I can see it always creates a new instance.
object. Probably not the clearest behavior in the world but it's
behaving correctly.
object and then creates another two. Is that supposed to happen?
this out. The Horde_Share::singleton() code uses an array $shares, so
it should be ok. Works so far without problems here. I've changed this
as the new kolab share handler uses internal references between parent
and child objects.
creates a child object that needs to be assigned by reference. So I
think a lot of the places you added it in Kronolith are unnecessary.
Can you add new patches that only add the & where it fixes a problem
we're seeing?
switch between the old and the new backend. This wrapper has a
back-reference to the Kronolith_Driver object, which breaks without
the change. The problem is you think its working, but you almost won't
notice it and then strange bugs occur when a variable inside the real
driver object changed and you still have an old copy of that object
floating around.
If you want to you can skip the "FBview.php" and "Kronolith.php" part
of the patch
as it was only changed to make the fix complete. I've just checked all
static variables in Kronolith, looks good to me.
I'm still wondering a bit about Kronolith_Driver::factory(). The
comment states it should return a concrete instance of a driver, but
as far as I can see it always creates a new instance. Also take a look
at lib/Scheduler/kronolith.php. It creates a global driver object and
then creates another two. Is that supposed to happen?
Cheers,
Thomas
State ⇒ Feedback
have been problems in the past with assigning a reference to a static
variable in PHP 4. It may work if the static variable is an array,
instead of overwriting the static directly. But if you have:
static $foo;
...
$foo = &new Bar();
Then the reference won't take.
Also, this should only matter if, in the constructor, the class
creates a child object that needs to be assigned by reference. So I
think a lot of the places you added it in Kronolith are unnecessary.
Can you add new patches that only add the & where it fixes a problem
we're seeing?
Thanks!
New Attachment: framework-share-reference-fix.patch
New Attachment: kronolith-fix-references.patch
Priority ⇒ 1. Low
State ⇒ Unconfirmed
New Attachment: reference_test_case.php
Queue ⇒ Kronolith
Summary ⇒ Fix for PHP4 reference handling
Type ⇒ Bug
while developing the new Kolab driver for kronolith I found out that
the reference handling in PHP4 is somewhat messed up. I've written a
small test case to demonstrate the problem. Attached you'll find a fix
for Kronolith and one for Horde_Share.
Cheers,
Thomas