6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
8/1/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#4062] Kolab.php compatibility with php5
*
Your Email Address
*
Spam protection
Enter the letters below:
. ..__. . __.. , | |[__] |(__ \./ |/\|| |\__|.__) |
Comment
>> One questions though, shouldn't the document object be passed by > >> reference to the dom constructors? > > > > As mentioned I forwarded the question: > > > > One of the Horde programmers wanted to know if it would be better to > > pass the parent document as a reference when creating Nodes, Elements > > or Attributes (http://bugs.horde.org/ticket/?id=4062). I am not quite > > certain if there is a specific reason against it so I thought I just > > try to ask you for your opinion. > > > > Answer from Alexandre Alapetite: > > > > I am not really sure to understand your question... > > > > 1) When creating a new element, there is already a (indirect) > reference to the parent document, as you can see on your line 155 > > (the "$this" reference) > > http://cvs.horde.org/co.php?r=1.5&f=framework%2FDOM%2FDOM.php > > > > function create_element($name) > > { > > return new > Horde_DOM_Element($this->node->createElement($name), $this); > > } > > > > On this line 155, the "$this" is referring to a Horde_DOM_Document > which is the parent document, which inherits from > > Horde_DOM_Node which contains a reference "$this->node" or to the > real PHP5 XML DOMDocument. > > > > > > 2) If you mean passing the parent document "by reference", in > opposition to "by value", this is not a good idea as objects > > variables in PHP5 are already references. When making an assignment, > there is no copy of the object. So passing the parent "by > > reference" would make a pointer of pointer quite strange, error > prone, and I do not see the interest. > > > > > > 3) In my library since version 1.8 I think, I have an additional > attribute "myOwnerDocument" for php4DOMNode objects (which you > > call "Horde_DOM_Node") which is a direct reference to the parent > document and provides speed improvement > > http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/ > > > > See line 196 of > > http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/domxml-php4-to-php5.php.txt > > You may want to update your code accordingly. > >
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