# Mem Leak in Tidy, ZE2 Bug?

- Thread: https://externals.io/message/10310
- Original archive: https://news-web.php.net/php.internals/10310
- Started by Christian Stocker on 2004-06-08T10:31:54+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10310 — Christian Stocker — 2004-06-08T10:31:54+00:00

URL: https://externals.io/message/10310#10310

Hi

I'm not sure, who to blame about this one, but I run against a memory 
leak if I run the following code:
***
$html = "foo";
$options = array("char-encoding" => "utf8");
$tidy = new tidy();
$tidy->parseString($html,$options,$options['char-encoding']);
print $tidy;
***

If the 3rd param is not part of the array of the second param, there's 
no memleak..

Any ideas, what's going wrong here?

If it's tidy, I'll file a bug report, if it's ZE2, it's maybe something 
to be fixed before 5.0.0 ;)

chregu

-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
http://www.bitflux.ch  |  chregu@bitflux.ch  |  gnupg-keyid 0x5CE1DECB

---

## #10311 — Nuno Lopes — 2004-06-08T10:42:39+00:00

URL: https://externals.io/message/10310#10311 · In reply to: #10310

> Hi
>
> I'm not sure, who to blame about this one, but I run against a memory
> leak if I run the following code:
> ***
> $html = "foo";
> $options = array("char-encoding" => "utf8");
> $tidy = new tidy();
> $tidy->parseString($html,$options,$options['char-encoding']);
> print $tidy;
> ***
>
> If the 3rd param is not part of the array of the second param, there's
> no memleak..
> Any ideas, what's going wrong here?

I have no problems here.
You shouldn't use the char-encoding as option (the second paramether)!! You
should just set the last parameter, as it will set the input and ouput
charset!!

there is also a open bug for tidy: http://bugs.php.net/?id=28578


> If it's tidy, I'll file a bug report, if it's ZE2, it's maybe something
> to be fixed before 5.0.0 ;)
>
> chregu

---

## #10313 — Derick Rethans — 2004-06-08T10:51:48+00:00

URL: https://externals.io/message/10310#10313 · In reply to: #10311

> You shouldn't use the char-encoding as option (the second paramether)!! You
> should just set the last parameter, as it will set the input and ouput
> charset!!

No need for those extra exclamation marks, and even *if* he used the
function wrongly it shouldn't leak memory.

Derick

---

## #10314 — Christian Stocker — 2004-06-08T11:58:39+00:00

URL: https://externals.io/message/10310#10314 · In reply to: #10311

> > […]
> 
> 
> I have no problems here.
> You shouldn't use the char-encoding as option (the second paramether)!! You
> should just set the last parameter, as it will set the input and ouput
> charset!!

See Derick's answer, that's not the point ;)

Anyway, I filed a bug report for tidy (there was also a second memleak) at
http://pecl.php.net/bugs/bug.php?id=1580

chregu
-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
http://www.bitflux.ch  |  chregu@bitflux.ch  |  gnupg-keyid 0x5CE1DECB

---

## #10315 — John Coggeshall — 2004-06-08T13:17:50+00:00

URL: https://externals.io/message/10310#10315 · In reply to: #10314

I'll poke around at it today

John


> 
> 
> > […]
> 
> See Derick's answer, that's not the point ;)
> 
> Anyway, I filed a bug report for tidy (there was also a second memleak) at
> http://pecl.php.net/bugs/bug.php?id=1580
> 
> chregu
> -- 
> christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
> phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
> http://www.bitflux.ch  |  chregu@bitflux.ch  |  gnupg-keyid 0x5CE1DECB
-- 
-=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-
John Coggeshall                   http://www.coggeshall.org/
The PHP Developer's Handbook    http://www.php-handbook.com/
-=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=

---

## #10320 — Ilia Alshanetsky — 2004-06-08T14:59:49+00:00

URL: https://externals.io/message/10310#10320 · In reply to: #10310

The leak had been fixed.

Ilia
