php.net |  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
 [2006-10-07 19:35 UTC] odinuv at gmail dot com
Description:
------------
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) https://81.27.200.150:13580/transformToDoc/test.php

URL2: (online 24/7, not showing the current mem usage - for downloading only) http://virklis.cust.ignum.cz/transformToDoc/test.php


Actual result:
--------------
Every page refresh produces a 2-4Kb raise in memory used by PHP (see live on https://81.27.200.150:13580/transformToDoc/test.php)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-07 21:29 UTC] tony2001@php.net
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:
http://virklis.cust.ignum.cz/transformToDoc/test.txt
XSLT Input file (1st argument): 
http://virklis.cust.ignum.cz/transformToDoc/1.xsl
XML Input file (2nd argument):
http://virklis.cust.ignum.cz/transformToDoc/1.xml
DTD:
http://virklis.cust.ignum.cz/transformToDoc/character-entities.dtd

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] chregu@php.net
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 5.2.0.0. 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:
http://virklis.cust.ignum.cz/transformToDoc/2.xml

That is:
1.xml causes the memory problem
2.xml does not cause that problem
 [2006-10-10 21:28 UTC] rrichards@php.net
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 http://www.php.net/support.php 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] tony2001@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC