ID:               45879
 Updated by:       [EMAIL PROTECTED]
 Reported By:      olivier dot berger at it-sudparis dot eu
-Status:           Open
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: Debian lenny
 PHP Version:      5.2.6
 New Comment:

Using ze1 compatibility you tell the "=" oeprator (and fucntion calls
and ...) you want a copy of the object, some classes can't be copied
(cloned) you'D have to use explecit references ($a =&$b) but at first
you don't want to mix PHP 4 code relying on that setting with PHP 5
code.

btw. that problem is one of the reasons why ze1 compatibility mode is
being dropped with 5.3. 


Previous Comments:
------------------------------------------------------------------------

[2008-08-21 09:44:34] olivier dot berger at it-sudparis dot eu

Description:
------------
When zend.ze1_compatibility_mode is on, there are clone problems when
iterating over the DOMNodelist items

With the following code, I get :
Fatal error: Cannot clone object of class DOMText due to
'zend.ze1_compatibility_mode' for instance

Reproduce code:
---------------
<?php
ini_set('zend.ze1_compatibility_mode', true);
$doc =& new DOMDocument();
$success = $doc->load('/tmp/test.xml');
$root =& $doc->documentElement;
$nodeList = &$doc->documentElement->childNodes;
for ($i = 0; $i < $nodeList->length; ++$i) {
    $node = &$nodeList->item($i);
    echo "$i - ";
    $nodeName = $node->nodeName;
    echo "$nodeName :";
    $nodeValue = $node->nodeValue;
    echo "$nodeValue <br/>";
}


Expected result:
----------------
I would expect it to display the XML file's contents as without
zend.ze1_compatibility_mode (in which case it works)

Actual result:
--------------
I get "Cannot clone object of class DOMText" wether with :
$node = &$nodeList->item($i);
or :
$node = $nodeList->item($i);

a :
foreach ($nodeList as $node) {
    echo $node->nodeName;
    echo $node->nodeValue;
}
won't work either.

I guess that the internals of DOMNodelist::item tries to clone them
instead of returning them by address, then.

Note that :
for ($i = 0; $i < $nodeList->length; ++$i) {
    echo "$i - ";
    $nodeName = $nodeList->item($i)->nodeName;
    echo "$nodeName :";
    $nodeValue = $nodeList->item($i)->nodeValue;
    echo "$nodeValue <br/>";
}
seems to work, though.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45879&edit=1

Reply via email to