#44066 [Opn->Fbk]: Inconsistent behaviour when using unset on SimpleXMLElements

From: Date: Thu, 07 Feb 2008 00:33:44 +0000
Subject: #44066 [Opn->Fbk]: Inconsistent behaviour when using unset on SimpleXMLElements
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122049@lists.php.net to get a copy of this message
ID: 44066 Updated by: rrichards@php.net Reported By: freddie at witherden dot org -Status: Open +Status: Feedback Bug Type: SimpleXML related Operating System: OS X PHP Version: 5.2.5 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. Previous Comments: ------------------------------------------------------------------------ [2008-02-06 23:28:11] freddie at witherden dot org Description: ------------ Calling unset on a SimpleXMLElement is inconsistent. Assuming $xml is a SimpleXMLElement and test is an 'array'. unset($xml->test); works, yet unset($xml->test[0]); (or any number does not). Elements returned from xpath queries can also not be unset. unset should work on all SimpleXMLElements, irrespective of where in a document they reside/how they were acquired. Failing this behaviour it would seem logical to generate a warning in the instance where one tries to unset an element which can not be unset. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44066&edit=1

« previous php.bugs (#122049) next »