ID: 41582 Comment by: dertonex at mail dot com Reported By: judas dot iscariote at gmail dot com Status: No Feedback Bug Type: SimpleXML related Operating System: Any PHP Version: 5CVS-2007-06-04 (CVS) Assigned To: dmitry New Comment:
[3] => Array ( [0] => F14 [1] => èññèÿÍåâûïîëíèì [2] => http://netitem.net [3] => 2:01:53 [4] => http://tittle-tattle.net ) [4] => Array ( [0] => http://allscandals.net [1] => Bedazzled [2] => http://webrumours.com [3] => 1:31:47 [4] => 672 ) Previous Comments: ------------------------------------------------------------------------ [2007-06-26 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-06-18 14:27:48] [EMAIL PROTECTED] The warning in first case is right. You cannot add element with index 1. In following examples you try to set XML attribute with name '2.5' and '0' and add somthing to this attribute. It is not possible to add something to attribute and engine told you that "Indirect modification of overloaded element of SimpleXMLElement has no effect". Memory leaks in such situation are expected. The only thing that I can do - prevent creaton of attributes with numeric names. ------------------------------------------------------------------------ [2007-06-18 13:39:04] [EMAIL PROTECTED] Dmitry: new comment added that may need your attention ------------------------------------------------------------------------ [2007-06-15 06:32:25] judas dot iscariote at gmail dot com Dmitry, first thanks for taking care of correcting the leak.. however.. now a funny warning is raised !! $xml->movie[1]->characters->character[]->name = 'Miss Coder'; causes : Warning: main(): (main ? x_X) Cannot add element movie number 1 when only 0 such elements exist in...(this part is correct though) that's not so annoying or critical and we can live with it, however does not look good. Addtionally I gave this stuff a better test now.. and Im still able to find some good as well edge/wrong cases where this stuff needs improvement. for example: $xml->movie[2.5]->characters->character[0]->name = ''; leaks memory as well. this is bad code of course ;) however I think this raises the real issue.. IMHO the code should check if the element number is >= 0 and an integer (not a float,maybe cast it to integer? and or emit warning/notice when the wrong type is used...) other case, that "looks" valid. // the string '0'; $xml->movie['0']->characters->character[0]->name = ''; leaks memory and emits... Notice: Indirect modification of overloaded element of SimpleXMLElement has no effect in .. but 0 as an integer works fine :-) ------------------------------------------------------------------------ [2007-06-13 13:53:02] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ 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/41582 -- Edit this bug report at http://bugs.php.net/?id=41582&edit=1