From: bo at theaddedones dot com
Operating system: solaris 8, OSX 10.3, Redhat
PHP version: 4.3.4
PHP Bug Type: XSLT related
Bug description: xsl:key has bad memory cleanup
Description:
------------
i have a slew of xml data that i need to select unique values from ... the
easiest method is via the xsl:key ...
when i ever i use xsl:key to make a key (regardless of if i use or not)
the xslt processor (libxml2 '20507', libxslt 1.0.30 -> 1.0.36 (the
versions i have tried)) i get an 'xmlFree' error IF i compiled the libxml
with the debug-mem option...if not i crashes the Apache (1.3.29) child
via a bus error...
the error....
Warning: Unknown(): Memory tag error occurs :0x6637671 bye in Unknown on
line 0
Warning: Unknown(): xmlMemFree(6637691) error in Unknown on line 0
Warning: Unknown(): xmlMallocBreakpoint reached on block 0 in Unknown on
line 0
interestingly, the entire XSL process works fine, and returns a properly
converted document (even the keys work properly), it jsut dies with the
memory error..i'm guessing something funny with garbage colleciton
Reproduce code:
---------------
the below should dump all the unique states in my data as a comma
separated list
<xsl:key name="state_key" match="images" use="state"/>
<xsl:for-each
select="//data[generate-id()=generate-id(key('state_key',state)[1])]"><xsl:value-of
select="state"/>,
</xsl:for-each>
save as a normal xslt file
try to compile using dom ala
domxml_xslt_stylesheet_file({your file})...
create some XML, and process the beast via 'process' you shall see the
error
Expected result:
----------------
no silly memmory failures
Actual result:
--------------
Warning: Unknown(): Memory tag error occurs :0x6637671 bye in Unknown on
line 0
Warning: Unknown(): xmlMemFree(6637691) error in Unknown on line 0
Warning: Unknown(): xmlMallocBreakpoint reached on block 0 in Unknown on
line 0
--
Edit bug report at http://bugs.php.net/?id=27236&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27236&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27236&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27236&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27236&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27236&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27236&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27236&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27236&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27236&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27236&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27236&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27236&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27236&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27236&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27236&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27236&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27236&r=float