php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39417 Tidy: Handling of 'new-blocklevel-tags' inconsistent
Submitted: 2006-11-07 22:19 UTC Modified: 2006-11-30 23:17 UTC
Votes:8
Avg. Score:4.5 ± 0.9
Reproduced:8 of 8 (100.0%)
Same Version:6 (75.0%)
Same OS:6 (75.0%)
From: konstantin dot ryabitsev at mcgill dot ca Assigned:
Status: Not a bug Package: Tidy (PECL)
PHP Version: 5.2.0 OS: Linux, Windows
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:
Package:
Bug Type:
Summary:
From: konstantin dot ryabitsev at mcgill dot ca
New email:
PHP Version: OS:

 

 [2006-11-07 22:19 UTC] konstantin dot ryabitsev at mcgill dot ca
Description:
------------
I seem to get odd behaviour running the following code. Theoretically (and confirmed by running command-line tidy utility), the output should contain all namespace-prepended tags. On my machine, the output only contains the <wps:block> element, and none of the elements contained within.

It's really weird. If I change the names to "wps:blo", "wps:var" and "wps:val", it works. I'm really confused at this point.

Reproduce code:
---------------
<?php
$contents = '
<wps:block>
 <wps:var>
   <wps:value/>
 </wps:var>
</wps:block>';
$config = array(
    'new-blocklevel-tags' => 'wps:block,wps:var,wps:value'
);
$tidy = tidy_parse_string($contents, $config, 'utf8');
$tidy->cleanRepair();
print "{$tidy->value}\n";
?>

Expected result:
----------------
<html>
<head>
<title></title>
</head>
<body>
<wps:block>
<wps:var>
<wps:value></wps:var>
</wps:block>
</body>
</html>


Actual result:
--------------
<html>
<head>
<title></title>
</head>
<body>
<wps:block>
</body>
</html>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-07 22:22 UTC] konstantin dot ryabitsev at mcgill dot ca
Specifying "Tidy:" in the Summary.
 [2006-11-08 03:07 UTC] iliaa@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.

This is a libtidy bug.
 [2006-11-08 14:40 UTC] konstantin dot ryabitsev at mcgill dot ca
I disagree. The bug does not occur when running tidy with the same parameters, only when invoked as part of a PHP script. I will ask on the libtidy support list, but I believe their answer will be to file a bug with php.
 [2006-11-23 18:04 UTC] konstantin dot ryabitsev at mcgill dot ca
Upstream Tidy developers have ruled that this bug is not a bug in libtidy, but a bug in php bindings.

http://sourceforge.net/tracker/index.php?func=detail&aid=1598422&group_id=27659&atid=390963

Please do not close as "bogus" -- this is a PHP bug that needs to be fixed.
 [2006-11-23 18:57 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Cannot reproduce.
I get the very expected result.
 [2006-11-23 20:51 UTC] konstantin dot ryabitsev at mcgill dot ca
No, same results with the latest CVS snapshot. I have now been able to reproduce this problem on the followin systems:

* Fedora Core 5
* Fedora Core 6
* RHEL 4
* Debian Unstable

It's not a corner case.

---------------------------
icon@rakta:[~]$ cat tidy.php
<?php
$contents = '
<wps:block>
 <wps:var>
   <wps:value/>
 </wps:var>
</wps:block>';
$config = array(
    'new-blocklevel-tags' => 'wps:block,wps:value,wps:var'
);
$tidy = tidy_parse_string($contents, $config, 'utf8');
$tidy->cleanRepair();
print "{$tidy->value}\n";


?>
icon@rakta:[~]$ php -version
PHP 5.2.1-dev (cli) (built: Nov 23 2006 15:32:59) 
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
icon@rakta:[~]$ php tidy.php
<html>
<head>
<title></title>
</head>
<body>
<wps:block>
</body>
</html>
 [2006-11-23 20:56 UTC] tony2001@php.net
Which Tidy version are you using?
 [2006-11-23 20:59 UTC] konstantin dot ryabitsev at mcgill dot ca
icon@rakta:[~]$ rpm -q libtidy
libtidy-0:0.99.0-11.20051025.fc6.i386

(this is the latest released -- I have previously built the latest CVS of libtidy while testing this bug, but there was no difference in the end-result)
 [2006-11-23 21:11 UTC] tony2001@php.net
Works just fine here using both libtidy-CVS and default SuSE version (built on Mar 19 2005).
Please update libtidy to the latest CVS, and if that doesn't help, harp on this to libtidy developers.

# ./sapi/cli/php /tmp/2.php
<html>
<head>
<title></title>
</head>
<body>
<wps:block><wps:var>
<wps:value></wps:var></wps:block>
</body>
</html>

# cat /tmp/2.php
<?php
$contents = '
<wps:block>
 <wps:var>
    <wps:value/>
         </wps:var>
         </wps:block>';
$config = array(
            'new-blocklevel-tags' => 'wps:block,wps:value,wps:var'
        );
$tidy = tidy_parse_string($contents, $config, 'utf8');
$tidy->cleanRepair();
print "{$tidy->value}\n";
?>

 [2006-11-23 22:11 UTC] konstantin dot ryabitsev at mcgill dot ca
It's great that it's working fine for you. However, it's not working for me, and I can now add Windows into the pile:

http://blues.mcgill.ca/~icon/misc/not-making-it-up.png

So, now reproduced on 3 different linux distros, and 2 different platforms.

I'm not sure how much more I can do to convince you that I'm not making this up.

I have tried the exact same parameters from tidy python bindings. I do not see the same error. The error only seems to occur when I use php bindings.

If you are going to close this bug, please don't close as bogus. This bug is real.
 [2006-11-23 22:28 UTC] tony2001@php.net
You seem to be the only (unlucky?) person on the earth able to reproduce it, hence it doesn't seem to me as a problem of PHP.
If you want to keep this report open and not to be marked as bogus, please provide at least some info required to reproduce it.
I'm very excited that Python bindings work fine for you. So does ext/tidy for me.
 [2006-11-23 23:10 UTC] yatiohi at ideopolis dot gr
We are at least two persons on earth :-)

[belbo@abu tmp]$ php -version
PHP 5.1.6 (cli) (built: Nov  2 2006 16:46:15) 
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
[belbo@abu tmp]$ rpm -q libtidy
libtidy-0.99.0-11.20051025.fc6
[belbo@abu tmp]$ rpm -q php-tidy
php-tidy-5.1.6-1.fc6
[belbo@abu tmp]$ cat tidy.php 
<?php
$contents = '
<wps:block>
 <wps:var>
   <wps:value/>
 </wps:var>
</wps:block>';
$config = array(
    'new-blocklevel-tags' => 'wps:block,wps:value,wps:var'
);
$tidy = tidy_parse_string($contents, $config, 'utf8');
$tidy->cleanRepair();
print "{$tidy->value}\n";

?>
[belbo@abu tmp]$ php tidy.php 
<html>
<head>
<title></title>
</head>
<body>
<wps:block>
</body>
</html>
 [2006-11-30 23:17 UTC] nlopess@php.net
The tidy team assumed this bug. The problem is clearly identified, although it isn't that easy to fix.
Anyway, this is not a bug in PHP, but rather in the libtidy.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 14:01:29 2024 UTC