php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28578 segfault when tidy parses PHP code
Submitted: 2004-05-30 14:14 UTC Modified: 2004-07-15 16:57 UTC
Votes:2
Avg. Score:2.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: nlopess@php.net Assigned: john (profile)
Status: Closed Package: Tidy (PECL)
PHP Version: 5CVS-2004-05-30 (dev) OS: win
Private report: No CVE-ID: None
 [2004-05-30 14:14 UTC] nlopess@php.net
Description:
------------
Using the provided script, PHP segfaults.

Reproduce code:
---------------
<?php
$tidy = tidy_parse_string('<? ?>');
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-30 22:35 UTC] jed at jed dot bz
PHP 5.0.0RC2. Run via CLI.

I was able to reproduce this bug. My gut feeling, which I will check after I submit this debug info (I have the debugger attached at present), is that <?php ?> will parse correctly.

Unhandled exception in php.exe (PHP_TIDY.DLL): 0xC00000005: Access Violation.

Unfortunately, I do not have the debug build of PHP. Best I can offer you is this:

PHP_TIDY! 00ab93fe()

That's my call stack. Sorry. I'll get the debug version of PHP and recheck this later, if I remember.

Rechecking my initial gut suspicion, this piece of code works fine.

$tidy = tidy_parse_string('<?php ?>');

My advice at present is to not use short tags in tidy-parsed code, as tidy's logic probably does not recognize <? ?> and attempts to parse it.

However, a worthy problem for looking into.
 [2004-05-30 22:36 UTC] jed at jed dot bz
Heh, sorry. That would be 0xC0000005.
 [2004-05-31 12:17 UTC] derick@php.net
Works for me on linux, assigning to the maintainer.
 [2004-05-31 15:16 UTC] nlopess@php.net
I've built PHP with latest tidy lib on cygwin and it doesn't segfault.
The problem can be in the libTidy itself, as the binaries provided by the snaps machine use a very old version of the libTidy.
 [2004-06-24 19:02 UTC] nlopess@php.net
I've found this is a libtidy problem!
More info at: https://sourceforge.net/tracker/index.php?func=detail&aid=964946&group_id=27659&atid=390963

The problem is that the windows binnaries use a old version of libtidy and still contain that error. Maybe its time to update this lib (it compiles in 5 minutes...)
 [2004-07-15 16:57 UTC] nlopess@php.net
Edin has updated the libtidy and the problem is solved.

Many thanks!
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 02 01:03:40 2021 UTC