|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39080 Memory leak in XSLTProcessor->transformToDoc()
Submitted: 2006-10-07 19:35 UTC Modified: 2006-10-12 15:40 UTC
From: odinuv at gmail dot com Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5CVS-2006-10-07 (snap) OS: win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: odinuv at gmail dot com
New email:
PHP Version: OS:


 [2006-10-07 19:35 UTC] odinuv at gmail dot com
Using a certain data the function call to XSLTProcessor->transformToDoc() produces a 2kb-4kb memory leak. This happens *only* on win32 (tested on NT 5.0 build 2195 and
NT 5.2 build 3790) platform. Reproduced succesfully on apache 2.0.55 and 2.0.59 with php 5.1.6 and todays snapshot 5.2.0RC6-dev.

Reproduce code:
Code is standard (taken from manual) procedure to transform XML+XSTL into a HTML document. Both URLs contain same files:
1.xml - source XML data
1.xsl - source XSLT data
character-entities.dtd - necessery entities definitions 
test.txt - PHP source code for the transformation

URL1: (not online 24/7, showing the current php process usage on server)

URL2: (online 24/7, not showing the current mem usage - for downloading only)

Actual result:
Every page refresh produces a 2-4Kb raise in memory used by PHP (see live on


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-07 21:29 UTC]
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.

 [2006-10-07 22:31 UTC] odinuv at gmail dot com
Since the script is 40 lines long i provided the link (as suggested) I'll write all the links directly:
PHP script source code:
XSLT Input file (1st argument):
XML Input file (2nd argument):

The script is 40 lines long to 
- load the input files
- do the transformation
- determine memory used by php
If it were shorter it wouldn't be complete. The input files are necessary for the problem to arise.
 [2006-10-10 07:01 UTC]
Which libxml2 and libxslt versions are you using? Could you try with the latest ones (if not already used).
 [2006-10-10 18:59 UTC] odinuv at gmail dot com
I don't think i have libxml or libxslt installed. I use php_xsl.dll bundled with the instalation which in my case says version and that afaik doesn't need libxslt
 [2006-10-10 20:05 UTC] odinuv at gmail dot com
After some more investigation i found an XML input very similar to the first one but it doesn't trigger the problem. The only diference is that it doesn't contain the HTML content in nodes <content>. I posted the XML on the web, the URL is:

That is:
1.xml causes the memory problem
2.xml does not cause that problem
 [2006-10-10 21:28 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

leak is from libxslt and reproduceable on other platforms and appears to be fixed in their CVS tree.
 [2006-10-12 15:28 UTC] odinuv at gmail dot com
I don't really think this report should be marked as bogus. I understand well that the problem is not in the PHP source code. But the problem definitely exists in PHP binary (that is php_xsl.dll which links the libxslt library). I also understand that at the moment there is nothing you PHP folks can do about this, but i also think that this report should not be forgotten as invalid.
 [2006-10-12 15:40 UTC]
The fact that it's not a problem of PHP means this report doesn't actually belong here and the problem should be reported to other people.
I.e. bogus.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Aug 11 01:01:25 2020 UTC