6.0.0-git
2019-03-23

[#4062] Kolab.php compatibility with php5
Summary Kolab.php compatibility with php5
Queue Kolab
Type Bug
State Resolved
Priority 2. Medium
Owners
Requester wrobel (at) gentoo (dot) org
Created 2006-06-20 (4659 days ago)
Due
Updated 2007-01-14 (4451 days ago)
Assigned 2006-11-14 (4512 days ago)
Resolved 2007-01-14 (4451 days ago)
Milestone
Patch No

History
2007-01-14 13:06:05 Jan Schneider Comment #18
State ⇒ Resolved
Reply to this comment
Yes, I guess.
2006-11-15 20:37:32 Chuck Hagenbuch Comment #17 Reply to this comment
So I have to admit that I am slightly confused, mainly because my
knowledge about php and references is rather limited. Did the answer
from Alexandre help or can I do anything else to resolve the question?
I think Jan's question was about passing by reference, and that this 
isn't necessary in PHP 5, so that should resolve it. Jan?
2006-11-15 11:58:12 wrobel (at) gentoo (dot) org Comment #16 Reply to this comment
So I have to admit that I am slightly confused, mainly because my 
knowledge about php and references is rather limited. Did the answer 
from Alexandre help or can I do anything else to resolve the question?
2006-11-15 11:56:21 wrobel (at) gentoo (dot) org Comment #15 Reply to this 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.


2006-11-14 17:19:23 wrobel (at) gentoo (dot) org Comment #14 Reply to this comment
Committed, thanks.
Thanks.
One questions though, shouldn't the document object be passed by
reference to the dom constructors?
I don't see a reason against it but the original script does not do 
that. So I passed the question to the original author. I hope that 
I'll get a reply and would report back then.
2006-11-14 16:16:09 Jan Schneider Comment #13 Reply to this comment
Committed, thanks.



One questions though, shouldn't the document object be passed by 
reference to the dom constructors?
2006-11-14 10:47:43 Jan Schneider Comment #12 Reply to this comment
Please document that including author, license, conditions etc. in
the file header.
As mentioned in the header of DOM.php the whole file has been derived
from this original script. Both the author and the source url are
mentioned in there. I don't know if DOM.php was derived from a very
Ok, I didn't look at the whole file, only the patch.
early version of that original script or if the original version only
included the functions that were necessary for horde at that time.
Only the ones necessary for the configuration code.
2006-11-14 10:46:15 Jan Schneider Deleted Original Message
 
2006-11-14 10:45:26 Jan Schneider Deleted Original Message
 
2006-11-14 10:45:10 Jan Schneider Deleted Original Message
 
2006-11-14 10:44:49 Jan Schneider Deleted Original Message
 
2006-11-14 10:00:43 wrobel (at) gentoo (dot) org Comment #11
New Attachment: framework_DOM_DOM.php-Kolab_PHP5_fixes-20061114[1].patch Download
Reply to this comment
Hm, attachment got lost
2006-11-14 09:58:43 wrobel (at) gentoo (dot) org Comment #10 Reply to this comment
It adds a number of additional functions from
http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/domxml-php4-to-php5.php.txt that are 
needed
by
Kolab.php.
Please document that including author, license, conditions etc. in
the file header.
As mentioned in the header of DOM.php the whole file has been derived 
from this original script. Both the author and the source url are 
mentioned in there. I don't know if DOM.php was derived from a very 
early version of that original script or if the original version only 
included the functions that were necessary for horde at that time.



The current version of the script from Alexandre Alapetite contains a 
number of additional functions not provided by DOM.php at the moment. 
I did only transfer those additional functions that are needed by 
Kolab.php.
Yes, with one exception: if-clauses must always use curly braces.
Fixed. See attachement.
2006-11-14 09:47:32 Jan Schneider Comment #9
State ⇒ Feedback
Reply to this comment
It took a while but now I converted Kolab.php to use the Horde_DOM
package. This is the first half of the patch which needs to be
applied to framework/DOM/DOM.php.
Great!
It adds a number of additional functions from
http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/domxml-php4-to-php5.php.txt that are needed 
by
Kolab.php.
Please document that including author, license, conditions etc. in the 
file header.
I hope I matched the style of the horde sources.
Yes, with one exception: if-clauses must always use curly braces.
2006-11-14 09:16:11 wrobel (at) gentoo (dot) org Comment #8
New Attachment: framework_Kolab_Kolab.php-Kolab_PHP5_fixes-20061114.patch Download
Reply to this comment
Second half of the patch that applies to Kolab/Kolab.php.



Both new patches apply to current horde cvs.
2006-11-14 08:52:28 wrobel (at) gentoo (dot) org Comment #7
New Attachment: framework_DOM_DOM.php-Kolab_PHP5_fixes-20061114.patch
Reply to this comment
It took a while but now I converted Kolab.php to use the Horde_DOM 
package. This is the first half of the patch which needs to be applied 
to framework/DOM/DOM.php.



It adds a number of additional functions from 
http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/domxml-php4-to-php5.php.txt that are needed by 
Kolab.php.



I hope I matched the style of the horde sources.
2006-08-04 22:22:01 Jan Schneider State ⇒
 
2006-08-04 22:18:07 wrobel (at) gentoo (dot) org Comment #6 Reply to this comment
This would require to rework the handling of xml within the Kolab 
driver. This is something I did not tackle so far. I probably won't 
have the time during the next weeks to do that. But I think it makes 
sense to keep this ticket open, since the conversion will be needed at 
some timepoint.
2006-08-04 22:08:08 Jan Schneider Comment #5 Reply to this comment
Are you going to update your patch?
2006-06-20 09:48:23 Jan Schneider Comment #4
State ⇒ Feedback
Reply to this comment
We already have a Horde_DOM class in CVS HEAD for exactly that 
purpose. It has been split out from Horde/Config.php (in FRAMEWORK_3), 
so it should be merged to FRAMEWORK_3 so it can be utilized by 
Kolab.php. A patch for that would be great.
2006-06-20 07:00:15 wrobel (at) gentoo (dot) org Comment #3
New Attachment: domxml-php4-to-php5.php
Reply to this comment
dom-domxml wrapper script
2006-06-20 06:59:27 wrobel (at) gentoo (dot) org Comment #2
New Attachment: kolab-php4-php5-dom.patch
Reply to this comment
domxml -> dom patch
2006-06-20 06:58:45 wrobel (at) gentoo (dot) org Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ Kolab.php compatibility with php5
Queue ⇒ Kolab
New Attachment: kolab_php-reference-3.1.1.patch
Reply to this comment
Kolab.php does not work together with php5.



There are some problems with references which can be fixed using the 
attached patch.



In addition Kolab.php uses the php4 domxml extension that has been 
retired in php5.



While it is possible to use a workaround (I will attach the necessary 
patches as comments) I guess it is not an acceptable solution to be 
included into horde. I'd be happy about a suggestion how to properly 
fix the code for horde and would correct the patch accordingly.

Saved Queries