ID: 41562
Updated by: [EMAIL PROTECTED]
Reported By: christian dot kaps at imaxx21 dot com
-Status: Assigned
+Status: Feedback
Bug Type: SimpleXML related
Operating System: Ubuntu 7.04 (Feisty)
PHP Version: 5.2.3
Assigned To: helly
New Comment:
Does this still happen with PHP 5.2.4?
Previous Comments:
------------------------------------------------------------------------
[2007-06-08 01:15:59] [EMAIL PROTECTED]
FWIW, works for me on Linux Fedora 6, 5.2 CVS. Libxml is 2.6.28
------------------------------------------------------------------------
[2007-06-07 12:19:18] [EMAIL PROTECTED]
It's assigned to the the maintainer.
------------------------------------------------------------------------
[2007-06-07 12:14:29] christian dot kaps at imaxx21 dot com
>>A downgrade to version 5.2.2. fix this issue.
<I can reproduce it with 5.2.2, 5.2.1 and 5.2.0, so you seem to be
wrong here.
You are right. The error occurs with version 5.2.2 too.
Can you tell me about the status of this bug?
------------------------------------------------------------------------
[2007-06-05 08:27:59] [EMAIL PROTECTED]
>A downgrade to version 5.2.2. fix this issue.
I can reproduce it with 5.2.2, 5.2.1 and 5.2.0, so you seem to be wrong
here.
Assigned to the extension maintainer (has nothing to do with the
engine).
------------------------------------------------------------------------
[2007-06-05 07:47:53] christian dot kaps at imaxx21 dot com
Sorry for my poor englisch.
I think this script is the trigger for this problem. But it is not the
only one. I can`t say what the other is!?
<?php
class Config_SimpleXML extends SimpleXMLIterator
{
public function xpath($query, $index = null)
{
$result = parent::xpath($query);
if (!$result) {
return array();
} elseif (is_numeric($index)) {
return $result[(int) $index];
}
return $result;
}
public function parent()
{
$parent = $this->xpath('parent::*', 0);
return $parent;
}
public function removeChild(Config_SimpleXML $child)
{
$cnt = 0;
$childXml = $child->asXml();
$this->rewind();
while ($this->valid()) {
if ($childXml === $this->current()->asXml()) {
if (isset($this->{$this->key()}->{$cnt})) {
unset($this->{$this->key()}->{$cnt});
} else {
unset($this->{$this->key()});
}
break;
}
$cnt++;
$this->next();
}
$this->rewind();
}
}
$xml = '<config><parent><child>text</child></parent></config>';
$xml = simplexml_load_string($xml, 'Config_SimpleXML');
$element = $xml->xpath('.//child', 0);
$element->parent()->removeChild($element);
?>
I use this to remove a node from an xml document. When i use the dom
object to remove the node, the error doesn`t occur.
What I can say is that the error occurs not ever when i call the
removeChild method. I have a script which has 2 calls of this method.
The first call is ok the second throws this error. Whereat not the call
himself is the segfault trigger, but in our environment where i can
reproduce the error it is a exit statement that throws the segfault
error.
A downgrade to version 5.2.2. fix this issue. I can remember that in
version 5.1.6 the error occurs too.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/41562
--
Edit this bug report at http://bugs.php.net/?id=41562&edit=1