ID: 41582
Updated by: [EMAIL PROTECTED]
Reported By: judas dot iscariote at gmail dot com
-Status: Assigned
+Status: Closed
Bug Type: SimpleXML related
Operating System: Any
PHP Version: 5CVS-2007-06-04 (CVS)
Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2007-06-06 11:28:56] [EMAIL PROTECTED]
Well, there are some cases which cannot be fixed at all.
Fortunately they only happen when the code is b0rked, so I don't think
it's critical.
Markus, can you think of any solution for the leak?
------------------------------------------------------------------------
[2007-06-06 10:53:13] judas dot iscariote at gmail dot com
fix works. but leaks memory in the above situation.
$xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?>
<collection></collection>');
$xml->movie[1]->characters->character[]->name = 'Miss Coder';
Zend/zend_execute.c(1249) : Freeing 0x00C97DA0 (24 bytes),
script=simplecrashes.php
=== Total 1 memory leaks detected ===
------------------------------------------------------------------------
[2007-06-05 10:03:18] [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.
------------------------------------------------------------------------
[2007-06-04 10:59:01] [EMAIL PROTECTED]
Marcus, check the patch out:
http://dev.daylessday.org/diff/bug41582.diff
------------------------------------------------------------------------
[2007-06-04 09:53:24] judas dot iscariote at gmail dot com
Description:
------------
the following code segafaults.
Reproduce code:
---------------
<?php
$xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?>
<collection></collection>');
$xml->movie[]->characters->character[0]->name = 'Miss Coder';
//or crashes too ( same issue)
//$xml->movie[0]->characters->character[]->name = 'Miss Coder';
var_dump($xml->asXml());
?>
Expected result:
----------------
Fatal Error: cannot use [] for reading.
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47237115809024 (LWP 23360)]
0x000000000056e7d0 in sxe_prop_dim_read (object=0xc94dd8, member=0x0,
elements=0 '\0', attribs=1 '\001', silent=0 '\0')
at /home/cristian/php5/ext/simplexml/simplexml.c:254
254 if (Z_TYPE_P(member) == IS_LONG) {
....
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41582&edit=1